A pet friendly community and blog
Google Analytics Custom Events Trackin

Event Tracking in WordPress with Google Analytics

Using Event Tracking in WordPress with Google Analytics allows you to track how your site visitors are interacting with your website. Tracking your events helps you to understand your most important content. Also, how visitors are interacting with them.

With over 2 million active installs, MonsterInsights is the most popular Google Analytics plugin for WordPress. Also, by setting up MonsterInsights you can get a better understanding of what is working and what is NOT working. It’s just like having your Google Analytics right on your dashboard at all times. It is a perfect plugin for those beginners that don’t feel comfortable doing much coding.

Unlike other Google Analytics plugins, MonsterInsights allow you to enable all advanced Google analytics tracking features. There is no need to hire a developer, I can show you how to set this up in WordPress with just a few clicks.

I did find it much easier to manage your analytics from your dashboard in WordPress. Especially if you have no previous coding experience or do not like to add snippets to links on your website.

Connecting Your WordPress Site To MonsterInsights

You will need to download the plugin to your WordPress. Once you have done that you now can connect your MonsterInsights to your WordPress Account.

*Disclosure: I only recommend products I would use myself and all opinions expressed here are our own. This post may contain affiliate links that at no additional cost to you, I may earn a small commission. Read full privacy policy here.“

One thing I love about MonsterInsights is how easy it is to set up and connect your site. No coding needed! Click on the link for full instructions from my other post on how to set up your Google Analytics.

Once connected you can now start to track your events that you want to evaluate for bringing more traffic to your site right from your WordPress Dashboard.

You do have to upgrade to use the Event Tracking on your website. The free version only will allow you to see the traffic stats and what posts are more popular etc. If you want to track more on what is bringing people to your website. Or Using the Event Tracking Feature. I would recommend upgrading.

In your settings, you were asked to select the recommended settings for your website. If you are using a cloaking plugin like Pretty Links you would need to add that in your settings. This way you can track your affiliates with Google Analytics.

What is Event Tracking in WordPress with Google Analytics

Event tracking allows you to view how others are interacting on your website with things like links, videos, downloads. You can also track some of these examples:

  • Affiliate links 
  • Add to Cart buttons 
  • Form Submit buttons 
  • File download buttons 
  • Outbound links 
  • Call-to-action buttons 

Example of Setting Up Tracking Affiliate Links

You can view your affiliate links tracking reports by visiting Insights / Reports / Publishers from your WordPress dashboard.

If you want to track one of your affiliate links for example  If you’re using ThirstyAffiliates to manage your affiliate links, You don’t need to configure anything. However, MonsterInsights has automatic affiliate links tracking already.

Setting Up a Custom Event

For setting up a Custom Event in MonsterInsights you will need to know a few things about these components: It is very similar to setting it up in Google Analytics.

  • Event Category: This is your call to action, for example, sign up for your newsletter or contact.
  • Event Action: The type of interaction. This could mean clicking on or downloading or even play a video.
  • Event Label: Additional information about the events you want to track. A button for donations or buy now would be a good example.

Both methods you will need to know what these event values are. You can set up Google Analytics custom events tracking in WordPress using 2 methods:

  • Using MonsterInsights Custom Link Attribution – EASIEST method
  • Adding a Parameter on your Link Manually

Using MonsterInsights Custom Link Attribution

The Custom Link Attribution feature also supports Google AMP pages, so you can precisely track your AMP optimized custom links. To create a custom link attribution, All you need to do is to add the following data-variable tags to the HTML of your link with this template:

<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>

Just like you would set up a custom event in google analytics you need to replace the values to your values. The snippet above would be replaced with my values if I had an event such as an offer to download an ebook on cat care. I would use :

<a href=”https://www.petfrenzy.ca/ebook-cat-care” data-vars-ga-category=”pdf” data-vars-ga-action=”download”>ANCHORTEXT</a>

*** Anchor text and site address would need to replace with YOUR own anchor text and website or page address.

If you are uncomfortable with adding codes into your website

You can download the header and footer plugin that will help do this for you. Remember when using HTML- hypertext markup language this is the skeleton of what you are creating. Using CSS is Cascading style sheets that are used to format the layout of Web pages. (Making things look pretty) and then you have JavaScript is a scripting or programming language that allows you to implement complex features on web pages such as downloads interactions that create a responsive page.

You can now go to your publisher’s tab in MonsterInsights to view your custom event report. Notice you will see all your reports from Affiliates to Top Landing Pages In this part of the dashboard.

If you want quick access to your MonsterInsights to view your sessions, page views, and Avg. duration you can click the insights tab on the top of your WordPress dashboard.

Manually adding a parameter onto your link

I have a full tutorial on Event tracking and how to set that up in your Google Analytics account.

Before viewing event tracking results in your reports, you must set up a custom event tracking on your site with Google Analytics: For information on setting this up, see the Tracking Basics guide.

Using onclick does require some JavaScript knowledge. The template to use:

onclick="__gaTracker('send', 'event', 'category', 'action', 'label', 'value');"

Just as you have done with the custom link attribution you would replace the values with yours. I will use the same scenario of the ebook in this example:

<a href=”https://www.petfrenzy.ca/ebook-cat-care” onclick=”__gaTracker(‘send’, ‘event’, ‘pdf’, ‘download’, ‘ebook’ , ‘0’);” >ANCHORTEXT</a>

You can now go to your publisher’s tab once again and view this report. It is simple and easy to use. The benefits of Event Tracking in WordPress with Google Analytics using MonsterInsights is that you don’t have to keep jumping screens. You can view all your analytics right from your WordPress Dashboard!

Fix things without having to jump tabs. The best part is that there is such limited coding needed to really use the full potential of MonsterInsights. By using these reports you can excel in your growth and even use them to help with creating more valuable content to your blog or website.

Written by
Bren Luft
Join the discussion