Wondering how to create Google Analytics event tracking in WordPress?
Then you have reached the right place.
In this article, I will explain how you can set up Google Analytics Event Tracking in your WordPress site easily. You will also learn how to view the reports directly on the dashboard of your WordPress site.
- What is Google Analytics Events?
- How to set up Google Analytics events tracking in WordPress
- What is MonsterInsights?
- Set Up Google Analytics Custom Events Tracking in WordPress Using MonsterInsights
- How to Set Up Google Analytics Custom Events Tracking in WordPress Using the onclick Method
What is Google Analytics Events?
Events are nothing but the user interactions on your website. It can be downloads, ad clicks, button clicks, etc.
Events can be tracked separately from the page views.
What is Events Tracking in Google Analytics?
Events tracking helps you track the user interactions on your website.
It is the best way to know how visitors behave on the site. You can also learn what is important or frequently visited pages or posts.
Events have many components as follows:
It is the group of similar events that you wish to track.
For example, CTA.
Type of interaction that you wish to track.
For example, clicking on the buttons.
Additional information about the event.
For example, the Buy button.
How to set up Google Analytics events tracking in WordPress
There are two methods you can use to set up Google analytics events tracking.
The first method is to use a WordPress plugin and add custom link attributes to your links.
The second method is a bit difficult since it involves adding the onclick parameters to your link manually.
If you are not technically sound, you can just use the first method with the use of the WordPress plugin.
For this method, we will be using the MonsterInsights WordPress Plugin.
What is MonsterInsights?
MonsterInsights is the leading WordPress plugin for Google Analytics.
It helps you use Google Analytics on your WordPress site easily.
There are more than 2 million active installations for this plugin. You can use the free version to check the basic features.
If you wish to use the advanced tracking features, then you should get the premium version of MonsterInsights.
Currently, MonsterInsights offers a discount. Check out this limited-time discount now!
Set Up Google Analytics Custom Events Tracking in WordPress Using MonsterInsights
Let us see how to set up Google Analytics Events tracking in WordPress easily using the MonsterInsights plugin.
Get MonsterInsights Pro to access link attribution features!
With the new custom link attribution in MonsterInsights, you can easily track the custom links.
Install and activate the Plugin
Purchase the MonsterInsights Pro version.
After purchasing the plugin, download the latest version of the plugin.
Upload the plugin on your site. Install and activate the plugin.
Copy the license key of MonsterInsights from the account page and paste it into the Settings > General tab of the plugin.
Connect MonsterInsights to Google Analytics
Connect the MonsterInsights plugin to your Google Analytics account.
Follow the steps given below:
- From the dashboard of your WordPress site, click on Insights.
- Click Settings and choose the General tab.
- Click on “Connect MonsterInsights” and click Allow.
- Choose the correct website and complete the authentication.
Set up custom events tracking in WordPress using MonsterInsights Custom Link Attribution
The custom link attribute feature helps you track the events on your links.
To track the events, you need to add the data-variable tags to your 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>
Once the tags are added, MonsterInsights will start to track the links and provide you with a complete report.
For example, I will show you how to create custom event tracking on a sidebar call to action button.
The product link page would be
Use the following event conditions:
Label: “Buy Button”
The custom event tracking link will look like the following:
<a href=”https://www.onlinedecoded.com/go/seopowersuite” data-vars-ga-category=”cta” data-vars-ga-action=”click” data-vars-ga-label=”Buy button” >Visit SEO Powersuite</a>
That’s all. Google Analytics Event Tracking in WordPress is set up now.
How to view custom events tracking reports
You can view the data for your Google Analytics Event tracking within the dashboard of your WordPress site itself.
Follow the steps:
From the dashboard of your WordPress click Insights.
Click on Reports and then on Publisher.
You will be able to see the top outbound links.
If you have created custom affiliate links, you will be able to see the top Affiliate links and their clicks.
How to Set Up Google Analytics Custom Events Tracking in WordPress Using the onclick Method
If you are looking for a method without using the plugin, then you can use this method.
But to use this method, you need to have Java knowledge.
In the previous method, we installed MonsterInsights plugin to connect to Google Analytics.
In this method, you need to add the Google Analytics tracking code manually to the header.php file on your site.
After connecting your site to Google Analytics, you can add the onclick parameter which will look like the following one:
onclick=”__gaTracker(‘send’, ‘event’, ‘category’, ‘action’, ‘label’, ‘value’);”
You need to modify the Category, Action and Value.
The final modified link will look like
<a href=”https://www.onlinedecoded.com/go/seopowersuite” onclick=”__gaTracker(‘send’, ‘event’, ‘cta’, ‘Click’, ‘Buy button’, ‘0’);” >Visit SEO Powersuite</a>
Once the link is updated, click on Save.
Whenever someone clicks on this link, you will be able to track it from your Google Analytics Account.
I hope you have learned how to set up Google Analytics Event Tracking in WordPress easily.
You can track the custom events easily within a few minutes using the MonsterInsights plugin.
If you have liked this article share it with your friends. If you have any questions, please comment below.