Try any GetResponse Plan for free. No credit card required

How to set up Google Analytics custom events tracking in WordPress

What are custom events in Google Analytics

By default, Google Analytics tracks only pageviews on your website. That is, which pages are being loaded and for how long users are staying on each page. Also, where the people are visiting from and which devices they are using to access your website.

But, Google Analytics can be used to track much more information than that. For instance, you know that you can track the scroll depth, file downloads, and authors on your website. But did you know that you can also track other user interactions like button clicks for call-to-actions on your website? For tracking these custom events on your website, you should set up custom event tracking.

How to set up Google Analytics custom events tracking in WordPress

There are two ways by which you can make Google Analytics track custom events on your website. The first method is by adding custom link attributes to your links using a simple WordPress plugin. And the second method is by adding an onClick parameter to your links manually, which involves some JavaScript code.

So, we will only be looking at the first method obviously since most of my readers are new WordPress users and not professionals.

For that purpose, we will be using the MonsterInsights Google Analytics plugin for WordPress. I have already reviewed it on my site (MonsterInsights review). Do check it out if you are interested in knowing more about this simple yet very useful plugin for integrating Google Analytics with your WordPress site. I am already using it on my site for managing all Google Analytics reports in one place, you can find it here.

monsterinsights - best ga plugin for wordpress

Now, coming back to how you can enable Google Analytics custom events tracking on your WordPress site, the first step is to install the MonsterInsights plugin on your site. MonsterInsights comes with a Custom Link Attribution feature which allows you to add custom event tracking to custom links on your site.

To make this work for custom links, you should add custom data attributes (data-vars) to your link’s anchor element. Ex:

<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>

Once you have added the above data-variable attributes to your custom links, MonsterInsights will start treating them as custom events on your Google Analytics dashboard.

How to view custom events tracking reports

You can now view detailed reports of the same by visiting Insights –> Reports –> Publisher from within your WordPress dashboard. Or, if you want to view them directly on your Google Analytics account, just click on the View All Outbound Links Report below the list.

outbound links report in ga

You can also track affiliate links and AMP pages in the same way by visiting Insights –> Settings –> Publisher and configuring the necessary options. And you can view the affiliate link reports on the same page as above.

track affiliate links in ga

So, that was it. Now, you know how to add Google Analytics custom event tracking on your WordPress site. Haven’t got MonsterInsights yet? You can now get it with 14 days money-back guarantee. If it doesn’t satisfy your needs, you can get a refund for the same.

Not interested in the Pro version? You can still check out the free MonsterInsights plugin on the WordPress plugin repository and then upgrade to the paid version if you need it.

Leave a Comment