Google Analytics Event tracking helps you understand what’s working and what’s not on a page. An event tracking tag, added to a URL, highlights the event in Google Analytics.
Why do you want to do this?
It’s very useful to know what aspects of your website are actually working. For example, are people clicking on a popup or other Call to Action? Are they clicking on the first button on a page or the third? The event tag will also tell you how many clicks are being delivered to a third party. Google Analytics event tracking helps you understand what’s working.
We tell our customers that measurement is important, but they should test big things. A CTA is a big thing. Adding a Google Analytics event tracking tag is worth the trouble.
But how do I add Google Analytics event tracking to my CTAs?
To add event tracking to a link use text mode in the wysiwyg editor. Add a GA event tag between the opening of the URL element, <a , and the href=”…. The HTML with the event tag looks like this:
<a onclick="ga(‘send’, ‘event’, ‘Category’, ‘Click’, ‘Label’);" href="https://example.com">Click Here</a>
The items with capitals, Category, Action, and Label are the items that you can use to identify the event.
The category is the object on the page. For example, a Pop-Up or a button. Action describes the type of interaction, a Click. Category and Action are required.
The event Label isn’t required but it’s useful for categorizing events. For example, you can use it to identify multiple buttons on a page or you might insert the following to determine seasonality differences over time: onclick=”ga(‘send’, ‘event’, ‘ABC Pop Up’, ‘Click’, ‘December’);” A newsletter link might be: onclick=”ga(‘send’, ‘event” “Newsletter Subscribe’, ‘Click’, ‘Winter 2019’);”
For the superuser, the good folks at Google have some detailed information available on the nuts and bolts of Google Analytics event tracking on their support site.
The Event Tag is handled differently when the Monster Insight Plugin has been installed. When it’s being used, use data-vars-ga-category and -action and -label as shown in the following example:
<a href="https://www.monsterinsights.com" data-vars-ga-category="Custom Category" data-vars-ga-action="Custom Action" data-vars-ga-label="Custom Label">Example</a>
One thing to be careful of, once you have added the event tracking tag using the Text tab do not return to the Visual tab. If you do, WordPress will strip out the code you added. Just click Update and be happy 🙂
Are you using event tracking tags?