How to Set Up Event Tracking with Google Analytics in WordPress

How to Set Up Event Tracking with Google Analytics in WordPress

Event tracking is a powerful feature of Google Analytics that helps you to track custom events on your website. It is useful to track file downloads, outbound links, button clicks, phone number clicks, email link clicks, and more on your pages. 

With event tracking, you can learn how visitors are engaging in different parts of the site and whether they click on your affiliate links as expected or not. Analyze statistics and make changes in your strategies like converting your links to buttons or vice versa to improve conversions. 

It is very easy to set up event tracking on Google Analytics. In this article, we'll elaborate the process with a step by step guide. 

Let us start.

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page.

Why Monster Insights?

MonsterInsights

MonsterInsights is an essential plugin for WordPress to track audience and expand your business. Keep an eye on your visitors and get in-depth reports of their activities like countries coming from, referral sources, session duration, etc. These statistics will help you to identify the target audience and the best channel to promote your content to bring more visits. 

It is easy to set up a Google Analytics account for your website and monitor traffic using MonsterInsights.  It is also possible to track your authors, categories, WooCommerce sales, ads, and many others using free add-ons of the plugin. In short, MonsterInsights is a great tool for business websites to find new possibilities and boost traffic. 

Key Features of MonsterInsights

These are the main features of MonsterInsights plugin,

  • Analytics dashboard
  • Real time statistics
  • Page insights
  • Search Console report
  • Universal tracking
  • Scroll tracking
  • Engagement tracking
  • Link tracking
  • File download tracking
  • ECommerce report
  • Custom dimensions
  • Form conversions
  • Author tracking
  • Categories/Tags tracking
  • Google Optimize
  • WoCommerce
  • MemberPress
  • Multisite support
  • Premium customer support
  • 14-days money-refund guarantee

Pricing

Plus

Pro

Agency

1 Website

Up to 5 Websites

Up to 25 Websites

$199/yr

$399/yr

$799/yr

Click this exclusive link to buy MonsterInsights with 50% discount in subscription plans (Limited period offer)

Setting Up Even Tracking in Google Analytics

Google Analytics usually track only user sessions and page views on your site. If you want to track individual links, video plays, and other similar events, then you should enable custom event tracking using coding. 

It is actually a complex process. But MonsterInsights made it simple and easier. Let us check how it works. 

A custom event has three components- Category, Action, and Label. You should assign them properly while creating every event. For instance, you are going to track a download link. Enter downloads as its category, file URL as action, and link text as label. 

Add the following data variable tags to the HTML code of your link to enable tracking, 

<a href="https://www.example.com" data-vars-ga-category="Custom Category" data-vars-ga-action="Custom Action" data-vars-ga-label="Custom Label" >Example</a>

For download tracking, the same code look like this:

<a href="https://www.yourwebsite.com" data-vars-ga-category="downloads" data-vars-ga-action="https://www.yourwebsite.com/link" data-vars-ga-label="download now" >Download</a>

Want to track your affiliate links? For that, this code could be useful for you. 

<a href="https://www.yourwebsite.com" data-vars-ga-category="outbound-link-aff" data-vars-ga-action="https://www.yourwebsite.com/refer/wpforms" data-vars-ga-label="Buy now" >Buy Now</a>

With custom event tracking, you can track form conversions as well. Us the following HTML code for the purpose. 

<a href="https://www.yourwebsite.com" data-vars-ga-category="form" data-vars-ga-action="Conversion/impression" data-vars-ga-label="Form ID" >Contact Us</a>

Replace Form ID with the form ID number that you need to track. 

Open MonsterInsights > Reports > Publishers to get reports of your custom events. 

Monster Insights Custom event tracking

MonsterInsights will show your affiliate link tracking report in a separate section. It will be like this, 

affiliate link tracking

Track your #affiliate links, downloads and more with Monster Insights #Analytics + 50% Off!

Click to Tweet

On-click parameter is another method to track your custom events. Here, you should insert a javascript code to initiate tracking. 

This is the common javascript for all custom events, 

onclick="__gaTracker('send', 'event', 'category', 'action', 'label', 'value');"

Replace category, action, label, and value based on your event type. For form conversions, the changes will reflect like this. 

onclick="__gaTracker('send', 'event', 'form', 'conversion', 'form ID', '1');"

If it is a Call to Action button, use the following code to track clicks. 

onclick="__gaTracker('send', 'event', 'cta', 'click', 'buy button', '0');"

That's it. 

Click here to buy MonsterInsights with 50% discount in subscription plans (Limited period offer)

MonsterInsights

MonsterInsights

MonsterInsights is an essential tool for your website to monitor traffic and grow business. It helps you to track anything like single posts, outbound links, affiliate links, lead generation forms, and more. 

14 Days Money Back Guarantee

If, for any reason, you don't like this amazing plugin, you can get a full refund anytime within 14 days after your purchase. If you have any issues, just get in touch with their friendly support team and they'll either help you out until you get the results you need or give you a swift refund.

14 Days


MONEY BACK GUARANTEE

Leave a Comment

Your email address will not be published. Required fields are marked *