How to Add Google Analytics Event Tracking in WordPress

Adding custom event tracking in google analytics is the way to analyze your website performance. Creating events in Google Analytics will help you evaluate all your crucial links and strategize the content.

In this article, I will walk you through how to add Google Analytics custom event tracking in WordPress easily.

I understand setting up the technical aspects of a WordPress website is not easier for non-techies at all. But, I will make sure it to a cakewalk for you.

We will be using MonsterInsights plugin in this article to add google analytics events.

Add Google Analytics Custom Events Tracking in WordPress

As you might already know, Google Analytics is made to track page views and users coming into the website. That means you will get an overall measurement of your website performance.

But, what if you would like to know how a particular page is performing and how your users are actually behaving with your content.

Understanding user interactions is the best way to optimize your content. Eventually, it will allow you to make more sales.

Well, there are two fantastic ways to add Google Analytics custom events tracking in the WordPress website.

  • Adding Custom Link Tracking with MonsterInsights (Perfect for non-techies)
  • Adding on-click Parameter on your Link Manually

We will see both of them so that you can choose the one you would prefer. But I found the first one, adding custom events tracking through monster insights would be the most easier one.

And most of the folks prefer to do so, as there are more advantages with that awesome tool in terms of extracting the deeply detailed data.

Let’s hop in, and see the first method in action.

Add Custom Link Tracking with MonsterInsights – Method 1

MonsterInsights is certainly a perfect fit for both beginner and advanced level users to track Google Analytics, no wonder why people call it as a best Google Analytics WordPress plugin. It deserves all those noises.

That’s the reason, many large scaled businesses rely on the tools in-depth and detailed statistics. The plugin presents the whole data in rich graphics,

MonsterInsights Plugin is being regularly updated and their custom link attribution feature will also allow you to track the user’s behaviors for your Call To Actions.

Sounds great, isn’t it? This will help your track the users behaviors and Optimize those call to actions for making more sales and conversions.

Create and Edit Custom even Tracking Links

1. Install MonsterInsights WordPress Plugin, and follow the setup wizard, which is super easy.

Adding event tracking for your custom WordPress links are super easy. You just need to edit your links and add some variable tags,

Here is an example tag might lookalike,

<a href="" data-vars-ga-category="Custom Category" data-vars-ga-action="Custom Action" data-vars-ga-label="Custom Label" >Example</a>

Once you add the tags to your WordPress links or any call to actions, MonsterInsights will start tracking those links. And shows you the detailed report right from your WordPress Dashboard.

For instance, if you want to create a call to action for your Sidebar Widget to sell WordPress Hosting. I will show you how you can add a custom event tracking for the same. The product pricing page would be,

Understand the event conditions in this scenario, to add custom even tracking links in your site.

  • Category: “cta”
  • Action: “click”
  • Label: “Visit SiteGround”

Now in this scenario, you need to edit your variable tags category, action, and labels with your desired ones.

<a href="" data-vars-ga-category="cta" data-vars-ga-action="click" data-vars-ga-label="Buy button" >Visit SiteGround</a>

We are all done. Let MonsterInsights do the remaining job for you to make more conversions.

2. To view all the links data, head over to WP Dashboard >> Insights >> Reports >> Publisher >> Top OutBound Links

There you will find all the data along with some default event tracking options.

  • Events tracking
  • Enhanced Link Attribution
Google Analytics Event Tracking

You can also view your affiliate links data if you have created event tracing links for even those.

  • Affiliate Link Tracking Options,
Affiliate Link Tracking

And if you have a small downloading section for your e-books, freebies, premium stuff, and probably some other stuff, those are trackable too.

File Download tracking (popular formats)

File Download Tracking

Add On-click Parameter on Your Link – Method 2

Well, the above one is the robust method to track links, but if you want to try another way, it exists too.

Probably a little more java skills required to implement. Let’s add custom WordPress event tracking using an on-click parameter.

Here is an instance of on-click parameter

onclick=”__gaTracker(‘send’, ‘event’, ‘category’, ‘action’, ‘label’, ‘value’);”

Considering this instance, we will replace or edit onclick tags category, action, and value with the event condistions which we have implemented earlier.

I have done the job for you and our final Call to action would look some like this,

<a href="" onclick="__gaTracker('send', 'event', 'cta', 'Click', 'Buy button', '0');" >Visit SiteGround</a>

Whoa, we are all good now.

Now, your sidebar widget is all set to get tracked. MonsterInsights will track custom events for each and every link you have created not only sidebar, whenever the users click on those.

So, I am pretty much sure now, you have learned two ways of how you can add google analytics event tracking in WordPress.

Follow the process for all your website and see the magic, in terms of conversions.

Recommended read: How to Stop Google Analytics to Track My Own Visits

Leave a Reply

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