In my recent articles, I have written about the installation guide of Google Analytics using the MonsterInsight WordPress plugin. Also, I have explained how MonsterInsights is useful for WooCommerce sites.
MonsterInsight is a popular WordPress plugin used for many purposes like Configuring the Google Analytics for a website, Scroll Depth Tracking, Author Tracking, WooCommerce sites, and many more.
Google Analytics will show you all statistics about your website visitors. However, if you want more details about how readers interact with your website, then MonsterInsight comes into the picture.
MonsterInsight with Google Analytics makes an excellent pair to track all kinds of website information. For example, we can follow the author’s performance, download tracking, and scroll depth tracking. In addition, you can read my recent articles.
- How To Set Up Author Tracking in Google Analytics by MonsterInsights?
- Scroll Depth Tracking Using Google Analytics by MonsterInsights
- How To Track File Downloads in WordPress Site?
This article will tell you how we can track a custom event in Google Analytics using the MonsterInsight plugin’s custom link attribution feature.
Google Analytics Custom Events
Google Analytics will help you to track the website traffic. The custom events are the user’s interaction with the website’s data like downloads, videos play, buttons, etc. We can track such events independently using MonsterInsight.
We can use event tracking to check which content is performing well, and also we can improve the performance of less valuable data.
Each event has three typical main components.
Event Category- This is the category of the events like CTA for the call to action button.
Event Action- This is the action performed by the user against each event. It could be a click, video play, etc.
Event Label- This is the label of the events. We can give it anything to identify the event.
You can track any events in Google Analytics using MonsterInsight. So let’s see how we can track it.
Set up custom event tracking
We can set up the custom event tracking in Google Analytics in two ways
- Using MonsterInsight custom link Attribution
- Adding the on-click parameter to the custom link
The first method using MonsterInsight custom link attribution is the easiest way to add event tracking. The second method required basic Javascript coding knowledge, but it is doable by anyone.
MonsterInsight Custom Link Attribution
If we want to track the events using the MonsterInsight plugin, install the plugin from the WordPress directory and activate it.
To activate the event tracking, you need to have the premium version of the MonsterInsight plugin.
Using the custom link attribution feature of MonsterInsight, we can track call-to-action buttons and see which buttons are performing well and which need to be optimized.
It is effortless to add custom event tracking with custom links to your blog. However, for tracking, we have to do some manipulation to the link we are going to track.
We have to add the data-variable tags to the HTML code of the link. Here is an example of a custom HTML link.
<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>
Like I said above, for each event, there are three components. Therefore, we have to provide the three components (category, action, and label) in the link.
That’s it. This is all configuration you need to do to track the events in your WordPress blog. Once you add all three tags, MonsterInsight will track the events.
I will show you the example for the same.
Suppose I have a button on my blog (Download) for downloading some resources. Then my custom HTML link would be like this.
<a href="https://www.scrollbucks.com/download"
data-vars-ga-category="CTA"
data-vars-ga-action="Click"
data-vars-ga-label="Download" >Download Resources</a>
Like this, you can add any event in the HTML links.
Analytics
If we have added the custom event tracking on our blog, we can track the analytics in the MonsterInsight dashboard.
All you need to do, go to Insights » Reports» Publisher and scroll down to see top outbound links.
Here, you can see the custom links that you have created with the label. In addition, you can see how many clicks happened to the links and other states as well.
If you have added the custom event tracking for affiliate links on your blog then you can check the stats of that as well.
Track Events Using On-Click Parameter
This is the second method by which we can track the events in the WordPress blog. We have to add the on-click parameter to a custom link that we are tracking in this method.
On click is a Javascript function. If you know Javascript, then this will be easy for you. If you are new, you can use the first method since both methods have the same functionality.
If you want to add the on-click parameter, then use the below template.
<a href="http://yoursite.com/pricing"
onclick="__gaTracker('send', 'event', 'category', 'Action', 'Label', '0');" >Buy Now</a>
Here, you need to change the Category, Action, and Label like the above method. Your link would look like this
<a href="https://scrollbucks.com/download"
onclick="__gaTracker('send', 'event', 'CTA', 'Click', 'Download Resource', '0');" >Download</a>
That’s it. Now, Goole Analytics will track the custom events. In this case, click on the download button.
You can track the performance of these custom events in Insights » Reports» Publisher.
In this way, you can use the MonsterInsight plugin to get more analytics about your websites. To enable custom event tracking, you need to buy the premium version of MonsterInsight.
If you like the above article then share it with your friends.