How to set up Google Analytics Event Tracking with MonsterInsights
If you want to set up Google Analytics event tracking, the WordPress plugin MonsterInsights is a great help. In this guide, I’ll explain what you need to keep in mind when setting it up.
What exactly is MonsterInsights?
MonsterInsights is a WordPress plugin that allows you to add Google Analytics and Google Optimize tracking code to your WordPress website. This is especially easy with the setup wizard.
What’s good is that you can display all Google Analytics data in the WordPress dashboard. By displaying the data, you can make faster decisions. Also, MonsterInsights makes it easier to use Google Analytics for any type of business.
Getting started with setup
Want to know how to set up Google Analytics custom event tracking in WordPress? Adding custom event tracking allows you to track and measure the results of your most important links and call-to-action buttons.
However, the setup process is a bit more complicated, especially for beginners. But this is where the custom link assignment feature of MonsterInsights plugin helps you.
MonsterInsights DSGVO compliant setup
With the entry into force of the General Data Protection Regulation (GDPR) in May 2018, website owners need to make sure that analytics tools on their website comply with the new data protection regulations. Fortunately, MonsterInsights can be easily configured to be DSGVO-compliant by, for example, anonymizing IP addresses and not collecting any personal data from website visitors.
Additionally, visitor consent still needs to be obtained with a cookie solution.
What are custom Google Analytics events?
Google Analytics custom events are user interactions. They include content such as button clicks, video games, downloads, and more. The events can be captured independently of page views or page loads. More detailed instructions at Google.
Google Analytics Event Tracking lets you check how your website visitors interact with content on your site. Tracking these events allows you to better understand and internalize the most important content. It also allows you to measure conversions. After you have the necessary data at your disposal, you can optimize the not-so-efficient content and thus increase conversions.
For example, if there is a “Buy Now” button on your website, you care about learning how users interact with it. Google Analytics custom tracking ensures that you can track how many users looked at the button and clicked on it.
An event is always composed of three main elements
The first is the event category. This is usually the name of the object your users interact with, for example CTA, which stands for Call to Action Button. Then there is the event action. This is the name of the interaction type, for example “Click”, so it is possible to click the buttons. The third element is the Event Name. Here you get more information about the events you want to track, for example the buy button on the page.
If you want to set up event tracking with call to action buttons, you can add the event conditions for the category with “CTA”, for the action with “Click” and for the label with “Buy now”, as described before.
After the setup is done, Google Analytics will record your clicks, in the form of custom events with the described values.
Now let’s take a look at how you can implement event tracking setup in WordPress.
How to set up custom Google Analytics events
Setting up custom event tracking for Google Analytics in WordPress – here’s how you go about it.
By default, Google Analytics only tracks page access hits. Therefore, it is recommended to set up custom event tracking with MonsterInsights. This way you can measure event hits, i.e. user interactions in combination with content.
Setting up Google Analytics custom event tracking in WordPress is possible in two different ways. The much easier method is to use a custom link association from MonsterInsights. Furthermore, manually adding
onclick parameters to your link is still possible.
As mentioned above, the first method is much easier than the second. With MonsterInsights’ Google Analytics plugin, setting up event tracking is much more straightforward in WordPress, in such a way that it can be done within minutes. Because it’s so simple, anyone is able to do it. Even though you don’t have any expertise in programming.
The second way requires manually inserting an Onclick parameter into your link. If you decide to go this route, some programming knowledge is essential.
But now let’s take a look at how you can add custom events tracking on WordPress using both ways.
Affiliate Tracking with MonsterInsights
This is also a really good feature of MonsterInsights and especially great for any marketing toolbox!
It’s best to use Pretty Links for your affiliate links. Then you can always use a prefix like
In the plugin
Insights > Settings > Publisher you only need to enter the prefix in the Path column and a label to the right of it in the Label column. See screenshot above.
The rest is done by MonsterInsights.
Event Tracking with MonsterInsights
In the first method you add the custom link tracking thanks to MonsterInsights. Currently, MonsterInsights is the best plugin for WordPress Google Analytics, in my opinion. It helps you to use Google Analytics with WordPress in a straightforward way.
From MonsterInsights there is a new feature to assign custom links. This allows you to easily add custom events tracking to your links. So it’s important that the new version of MonsterInsights plugin is installed on your website, otherwise you won’t be able to use this feature.
Maybe also interesting for you: Visualize website structure
With MonsterInsights’ new custom link assignment feature, you can track your call-to-action buttons and see how important they are for your site’s conversions. This way, you’ll learn how users tend to interact with the links.
It’s easy with Monsterinsights to include WordPress links in custom event tracking. To do that, you just need to add the data variable tags listed below to your link’s HTML code. They look like this:
<a href="https://www.beispiel.com" data-vars-ga-category="Custom Kategorie" data-vars-ga-action="Custom Aktion" data-vars-ga-label="Custom Bezeichnung">Beispiel Link</a>
After you add the three tags, MonsterInsights will track your WordPress links and show you detailed reports. We’ll now show you how to add custom events tracking with a call to action to your website’s sidebar. Let’s say that the Call to Action button there is a link that leads to your price list, which might look like this:
There you use the following event conditions, namely for the category “CTA”, for the action “Click” and for the label “Buy Button”.
You just need to replace the event category, action and label with the desired event conditions. It would look like this:
<a href="https://www.beispiel.com/preisliste" data-vars-ga-category="cta" data-vars-ga-action="klick" data-vars-ga-label="kaufen nutton">Jetzt Kaufen</a>
Manually adding an onclick parameter to your link
Alternatively, you can add custom WordPress event tracking with the help of the
The format of the
onclick parameter looks like this:
onclick="__gaTracker('send', 'event', 'category', 'action', 'label', 'value');"
In order for you to add the
onclick parameter as just shown, you need to replace the category, action, and value with the event conditions you set earlier. Once you have done that, the link with the call to action will look like this:
<a href="http://yoursite.com/preisliste" onclick="__gaTracker('send', 'event', 'cta', 'Click', 'jetzt kaufen', '0');">Jetzt Kaufen</a>
If you’re wondering why the code uses the
__gaTracker function and not the default
ga, the question is easily answered:
__gaTracker is simply an alias for
Nothing more is needed. Now Google Analytics tracks your custom events when users on your site view or click the button.
With this guide to setting up Google Analytics Events Tracking with MonsterInsights, the process should be much easier for you now.
Publisher Reports (Premium)
In order for you to see your event tracking links data, you need to switch to the Publishers report in MonsterInsights. Go to Insights > Reports and then to Publisher. Then scroll down and look at the Top Outbound Links report after creating a custom link, like the price list. You will see the respective links and the total clicks on them.
If you have created a custom affiliate link, you can view the report for it under the item Top Affiliate Links. There you will see the labels, the links and the total number of clicks.
The feature to assign custom links also supports Google AMP pages. This means that you can accurately track your AMP optimized custom links.
Conclusion Event Tracking with MonsterInsights
I’ve always set up click tracking manually using Google Tag Manager. But there you have to really learn the ropes and fiddle around. With the WordPress plugin MonsterInsights the whole mumbo jumbo is installed in 10 minutes. Therefore my recommendation.
There is a free version of the plugin and the premium version. Basically, you can do everything learned with the free plugin. Only the events you have to look directly in Google Analytics, because the publisher area is reserved for Premium.