How To Easily Add Events Tracking In WordPress?

Do you want to know how to setup events tracking in WordPress?

Well, you got the right place where you are going to see how exactly you can set up events tracking in your WordPress website.

I will show you two ways which you can use to add events tracking:

  1. Adding custom link tracking using MonsterInsights
  2. Adding oneclick parameter on your link

However, adding onclick parameter to your links manually is a little tricky which beginners might not comfortable setting up.

This is where MonsterInsights WordPress makes it easy for beginners to set up events tracking without digging into technicalities.

What Are Events In Google Analytics?

Events are the user interaction with your content like downloads, videos plays, button clicks, form submissions, flash elements etc.

Event tracking makes easy for you to find how your visitors are interacting with your site content. It will help you to get the insights and show you the weak areas you can work to improve.

An event has 3 main components:

  1. Event Category: Event category is basically the name of the object you set tracking for. Eg. CTA Button, Newsletter signup form etc.
  2. Event Action: Event action is the name of the interaction your users take with site content. Eg. Clicks, Form submission etc.
  3. Event Label: Event label is the additional information about the event you want to track. Eg. Buy Button.

Let’s take an example here: If you want to set up a custom tracking for your call-to-action button. Your conditions will be like below:

  • Event Category: CTA
  • Event Action: Click
  • Event Label: Buy Button

Once your tracking is live, Google analytics will show reports for your call-to-action button. You will be seeing how many users viewed your button and how many clicks that button got.

Now, I hope you are clear about the event tracking. Let’s take a look and see how you can set up event tracking in your WordPress site.

How To Setup Google Analytics Custom Events Tracking In WordPress?

As I mentioned above, I will show you two different ways to setup up Google Analytics custom events tracking in your WordPress site.

The first one is using the MonsterInsights Custom Link Attribution which is the easiest method for the beginners to add custom event tracking in WordPress.

Second one is by adding oneclick parameter on your links manually which you might found tough if you are a newbie in WordPress.

So, let’s start with the first one…

Method: 1 Add Custom Events Tracking Using MonsterInsights

MosterInsights is the best Google Analytics plugin for WordPress which makes easy for non-SEO experts to understand the Google analytics data. It shows your Google analytics data on your WordPress dashboard in a very simple to understand way.

MonsterInsights Events Tracking

You can learn more about the MonsterInsights and its features in this complete MonsterInsights review.

For setting up custom events tracking, first, you need to download and install Google Analytics Dashboard Plugin for WordPress by MonsterInsights in your WordPress site.

Which you can easily do by going to Plugins>Add New…


There will be some steps that you need to follow and enter some information about your website.

MonsterInsights introduced a new Custom Link Attribution features that makes it handy to set up custom events tracking in WordPress.

You can use this feature to track custom events on your site, and easily know how visitors are interacting with your site content.

It will also show you the weak areas which needs your attention to get good results. You can easily fix them to improve the conversion.

MonsterInsights makes it easy to add custom events tracking. All you need to do is to add the following data-variable tags to the HTML link.

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

Make sure to replace the tags with your custom tracking events conditions.

For example, if you want to add custom event tracking for your call-to-action button.

Here, we’ll use the following conditions:

  • Category: “cta”
  • Action: “click”
  • Label: “Buy button”

So, you need to replace the event category, action and label with your event conditions. Then your custom event tracking code for call-to-action button will look like:

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

So, this is how you can set up custom events tracking for your links in a WordPress site using MonsterInsights.

Now you can view the reports of custom tracking you set up by going to Insights>Reports>Publisher.

Scroll down to the Top Outbound Links report if you create custom tracking for a call-to-action button.

If you added a custom tracking to track affiliate links then you can view the reports in the Top Affiliate Links report to see the number of clicks your link got.

Now let’s take a look at the second method adding a onclick Parameter on your link to setup custom events tracking on WordPress.

Method: 2 Adding Onclick Parameter On Your Link

This is the second method you can use to set up custom events tracking. You might found it tough to set up if you are a total newbie.

In this method, you need some Javascript skills to follow this method.

Below is the onclick parameter that you need:

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

As same in the first method, you need to replace category, action and label. The code will look like this:

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

So, this is how you can setup Google Analytics custom events tracking using the onclick parameter.

I hope you found this tutorial useful if you did then must share it with others.

Feel free to share the problem you are facing while setting up events tracking in your WordPress site.

Leave a Comment

Share via
Copy link
Powered by Social Snap