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. If you want more details about how readers are interacting with your website then MonsterInsight comes in the picture.
MonsterInsight with Google Analytics makes a good pair to track all kinds of website information. We can track the author’s performance, download tracking, and scroll depth tracking. 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?
In this article, I 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 effective 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. Let’s see how we can track it.
Set up custom event tracking
We can set up the custom event tracking in Google Analytics by two ways
- Using MonsterInsight custom link Attribution
- Adding the on-click parameter to the custom link
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 needs to be optimized.
It is very simple to add custom event tracking with custom links in your blog. For tracking, we have to do some manipulation to the link which 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. 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 type of events in the HTML links.
If we have added the custom event tracking on our blog then 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. 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 WordPress blog. In this method, we have to add the on click parameter to a custom link which we are tracking.
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="http://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 the custom event tracking you need to buy the premium version of MonsterInsight.
If you like the above article then share it with your friends.
Latest posts by Amit Kharbade (see all)
- How To Track Enhanced eCommerce in Restricted Content Pro and GiveWP? - March 27, 2021
- How to Use Smart Tags for Dynamic Text Replacement in OptinMonster? - March 20, 2021
- How to Easily Use Lead Source Tracking in Google Analytics? - March 15, 2021