Having trouble with creating custom event tracking with google analytics in WordPress?. Before moving into that topic, Take a look at this article if you are a beginner and make sure you are aware of What’s Google Analytics and How to Install Google Analytics in WordPress?.
Now, Let’s see what is Custom event tracking and How to set up Event Tracking with Google Analytics in WordPress.
List of Contents
What’s Custom Event tracking?
Google Analytics can be used to track information regarding your website’s page views, audience location, which devices they use to access your website, etc… by default. You would have known that with Google analytics you can track much more information than you Imagine.
Do you know? with Google Analytics, you can also track user interactions with content like downloads, videos, button clicks, flash elements, etc and that’s what we call as Event tracking.
You can understand your most important content and measure conversions when tracking your events. With the right data, you can optimize your effective content and boost your conversions. Now, let’s get into How to set up Event Tracking with Google Analytics in WordPress
How to set up Event Tracking with Google Analytics in WordPress
To create easy event tracking with google analytics in WordPress, you have two methods. One is the by using a WordPress plugin and another is by adding some codes to your website manually which needs some coding knowledge.
Let’s first explore the first part which is an easy one.
1. MonsterInsights plugin –
MonsterInsights is one of the simple and powerful plugin for integrating Google analytics with your WordPress website. Once you have added the MonsterInsights plugin you have the power to view the stats and other reports directly on your WordPress dashboard.
With MonsterInsights you can finish off the whole process within minutes. MonsterInsights comes with both a free and a pro version. I’ll leave you a link below to check the full features and information regarding MonsterInsights.
So, now let’s see how to create easy event tracking with google analytics in WordPress. The First step you have to do is to install the latest version of MonsterInsights plugin to your website. MonsterInsights has a Custom link attribution feature which allows you to easily add custom event tracking to your custom links.
With this feature, you can add event tracking to different important links such as your subdomains and see how users interact with those links. You can also track your call to action buttons to find out how relevant they are for your site’s conversions.
To make it work you should add a custom data attributes (data- vars) to the HTML of your 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 you have added the tags, MonsterInsights will start to track your WordPress links and provide you with a detailed report. It will automatically treat them as custom events on your Google analytics dashboard.
How to view the Custom events Tracking reports?
To view the data from your custom event tracking link, Go to Insights→ Reports→ Publisher. Now, scroll down and view the Top Outbound links report if you created a custom link like the one for pricing in the example below.
The custom link attribution feature also supports Google AMP pages, so you can track your AMP optimized custom links with more accuracy. With this feature, if create a custom affiliate link, you can also view the Top affiliate links report with the number of clicks.
so, that’s it. Now, you know How to set up Event Tracking with Google Analytics in WordPress website. If you have MonsterInsights you can create custom event tracking within minutes. If you are not interested in the Pro version, you can still check the MonsterInsights free plugin.
Alright, Now the manual part.
2. Adding Onclick Parameter on your Link
In this part, you will have to add the codes manually and as I mentioned earlier you’ll need some javascript skills to implement this.
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 will replace category, action and value with event conditions we set before. Now, the link would look like the below one,
<
a
href
=
"http://yoursite.com/pricing"
onclick
=
"__gaTracker('send', 'event', 'cta', 'Click', 'Buy button', '0');"
>Buy Now</
a
>
There you go, Now Google Analytics will track your custom events when your site users view or click on the button.
To get more articles regarding WordPress, Travel, Tech, Motivation and more.. Do sign up to my Newsletter.
Continue reading my posts on-
- How to Install Google Analytics in WordPress by MonsterInsights
- How to Create a Quiz in WordPress website.
- Thalli Pogadhey (Chennai to Pondicherry Road trip)
- How to Start a Blog? Doesn’t know where to start?
- How to Create a Calculator in WordPress Website
- How to collect Paypal payments on your WordPress site
- Life Is Hard than we Think!
Like this Post? Do share it with your friends
Leave a Reply