Google Analytics Event Tracking for WordPress

Google Analytics is the trusted tool for tracking website traffic and usage. Most people are used to checking their daily or monthly website page visits and some go beyond to view more detailed information on their visitors such as locations, age, devices and more.

One advanced tools for tracking website usage is Google Events. This tool is used to measure how users interact while on your website. For example, how many times a clicks on a certain link or how many times a file is downloaded.

In this article I will show you how to quickly get Google Events working on your WordPress site so you can start tracking.

The steps will include the following:

  • Decide what events are to be tracked
  • Categorize these events into similar groups
  • Add code to your site
  • Add CSS class to events to be tracked

1. Make sure you have a Google Analytics account. If not, you can get one here.

2. Make sure you have a Google Analytics tracking code and it’s installed on your site manually or with a plugin. You may need to activate ‘Events’ in your account before getting the updated tracking code. To do so go to the Analytics profile dashboard and under ‘Behavior‘ on the left menu click on ‘Events‘.

3. Install and activate the Gravitate Event Tracking plugin for WordPress.

4. Go to your Gravitate WordPress settings to view or add any custom events to track.

gravitate_example_one

 

5. You are now tracking all file downloads with Google Analytics.

6. To add a custom event you’ll need to define a CSS class in your WordPress theme stylesheet and use that class for the custom event link. By default the plugin adds one called ‘gtrack’ for you. To use this just add the class to any link.

An example would be like the following:

<a class=”gtrack” href=”http://www.wordpress.org”>WordPress</a>

 

7. Make sure you categorize your links as you wish to see them in your Google Analytics dashboard.

8. You are now ready to view your events in Google Analytics under ‘Behavior‘ > ‘Events‘.