How to Add Google Analytics Custom Events Tracking in WordPress? Tracking the most important links to your website is very important. This tutorial will help you to set up Google Analytics Custom Events Tracking in WordPress website. Adding custom event tracking helps you to track and measure the results of your most important links and call-to-action buttons.
Setting up custom event tracing in Google Analytics is very tricky and difficult for beginners. Hence you require a WordPress plugin that can make you event tracking much more easier.
MonsterInsights is the right plugin that can easily Add Google Analytics Custom Events Tracking in WordPress. The best part is that even the beginners can set up event tracking in a few clicks.
In this article we will be covering the step-by-step method to set up Google Analytics Custom Events Tracking for your WordPress website. However, we will be also covering the traditional method of event tracking too.
- Method 1: Adding Custom Link Tracking with MonsterInsights
- Method 2: Adding on-click Parameter on Your Link
- Method 3: Creating Your Event in Google Analytics
As I have already mention that the traditional method would be little bit tricky for the beginners and hence we would recommend you to go with MonsterInsights WordPress plugin.
MonsterInsights is the best WordPress plugin that allows you to track the complete analytics of your website directly from the WordPress dashboard.
Note: The founder of MonsterInsights is Syed Balkhi the man behind WPForms (Read Review) and OptinMonster (Read Review).Now it’s a premium plugin that’s used by hundreds of thousands of websites.
MonsterInsights is the free WordPress analytics plugin but if you want the professional features to take your website to the next level then you must go with the premium version. They are offering 50% discount to all Bloggersutra readers. You can click the link below to get your premium license.
Get 50% Discount on MonsterInsights Premium License
Before we proceed further with the tutorial it is important to understand What are Google Analytics Custom Events?
What are Google Analytics Custom Events?
Event tracking allows you to measure and track user interactions on your website. These interactions can be things like clicking on a button, playing a video, downloading files, submitting forms, etc.
Event tracking allows you to track how your website visitors are interacting with your site content. Tracking your events helps you to understand the most important content on your website and thus helps in measuring conversions.
Plus, once you have the right data, you can optimize your less effective content and boost your conversions.
An event has 3 main components:
- Event Category: Typically the name of the object users interact with. Eg. “CTA” for call-to-action buttons.
- Event Action: Typically the name of the type of interaction. Eg. “Click” for clicking on the buttons.
- Event Label: Additional information about the events you want to track. Eg. “Buy Button” for your sidebar button.
So if you want to set up call-to-action button event tracking, you can add event conditions like the ones below:
- Category: “CTA”
- Action: “Click”
- Label: “Buy Button”
Once it’s set up, Google Analytics records your call-to-action button clicks as custom events with the above values.
Now you must be clear about Google Analytics custom event tracking. Now let’s see how to create them.
Add Google Analytics Custom Events Tracking in WordPress
By default Google analytics tracks only the page view hits. So you need to set up a custom event tracking to measure hits (users’ interactions with the content).
You can set up Google Analytics custom events tracking in WordPress using 2 methods:
- Using MonsterInsights Custom Link Attribution – EASIEST METHOD
- Adding on-click Parameter on your Link Manually
- Creating Your Event in Google Analytics
The first method is the easiest method and don’t require any coding knowledge. Event tracking is some what similar to Author tracking in WordPress website. However, methods of setting up both of them is different.
Also Read, How to Set Up Google Analytics Enhanced eCommerce Tracking for WooCommerce
The second method involves adding an onclick parameter on your link manually. In order to execute this method, you should have some coding skills.
Now, let’s see how to add custom event tracking in WordPress from these 2 methods one-by-one.
Method 1: Adding Custom Link Tracking with MonsterInsights
As I have already mentioned MonsterInsights is the best Google Analytics plugin offering tons of features to take your business to the next level.
MonsterInsights have recently introduced a Custom Link Attribution feature. If you have already purchased the plugin then don’t forget to update the plugin. The Custom Link Attribution feature allows you to easily add custom event tracking to your custom links.
The Custom Link Attribution feature allows to track the call-to-action buttons to give you an idea about its performance and how effective it is for your website conversion. It also allows you to track the important links on your website (example affiliate links)
To add Google Analytics Custom Events Tracking to your website link you just need to add the following data-variable tags to the HTML of your link:
Once you add the tags, MonsterInsights will track your WordPress links and provide you with detailed reports.
Let’s take a example for better understanding on how to Add Google Analytics Custom Events Tracking in WordPress website.
For Example, we’ll show you how to add custom event tracking on a sidebar call-to-action button. Suppose the sidebar call-to-action button link is: https://www.example.com/pricing
Here, we’ll use the following event conditions:
- Category: “cta”
- Action: “click”
- Label: “buy button”
Now, you’ll need to replace the event category, action, and label with your event conditions. Then your custom event tracking link will look like the one below:
Now you have successfully addedd the custom event tracking to the sidebar link on your website. Now it’s time to check out the report of the custom event tracking that you have created.
To check the performance report Go to Insights » Reports» Publisher.
Next, scroll down and view the Top Outbound Links report if you created a custom link like the one for pricing in the example.
And if you created a custom affiliate link, you can view the Top Affiliate Links report to see the number of clicks.
The Custom Link Attribution feature also supports Google AMP pages, so you can precisely track your AMP optimized custom links.
Method 2: Adding onclick Parameter on Your Link
The onclick parameter goes in the following format:
onclick="__gaTracker('send', 'event', 'category', 'action', 'label', 'value');"
To add the onclick parameter in our example, we’ll replace category, action, and value with the event conditions we set before. Finally, the call-to-action button link will look like the one below:
onclick="__gaTracker('send', 'event', 'cta', 'Click', 'Buy button', '0');"
That’s it! Now Google Analytics will track your custom events when your site users view or click on the button.
Method 3: Creating Your Event in Google Analytics
in this step you need to create a event with in your Google Analytics account. Simply log into your Analytics dashboard and click on the Admin link at the top.
There are three columns under the admin page. Click on the ‘Goals’ link under the ‘View’ column.
Next, click on the new goal button to create a goal. From the Goal Setup options, you need to select the custom option and then click on the next button to continue.
In the next step you need to provide a title for your custom goal. Under the goal type, you need to select Event. After that click on the next step button to continue.
The last step is to provide goal details. You will need to enter the event conditions here.
Analytics will count a conversion when all these conditions match.
If you feel that your event should pass on a value that can be calculated, then you can enter that value here. However, for most common event tracking using the value to be 0 works fine too.
Finally click on the create goal button to save and activate the goal.
Wrapping Up Custom Even Tracking
We have seen that event tracking is the best solution to track your important website links and measure your conversions. However, the traditional method of custom event tracking is difficult for beginners and requires some coding knowledge.
To overcome this I personally use MonsteInsights WordPress plugin on all my and my client’s websites. The Custom Link Attribution feature allows you to easily track your important links and call-to-action buttons within few clicks.
MonsterInsights simplifies the procedure to Add Google Analytics Custom Events Tracking in WordPress website. If you have still not purchased the premium license of the plugin then click on the link below and grab you license at 50% discount.
Get 50% Discount on MonsterInsights Premium License
If you have any doubt in setting up custom event tracking for your WordPress website then leave a comment at the end of this article and we will be more than happy to assist you in tracking important link on your website.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.