Coding Series: Part 5 – Event Tracking
This is the fifth and final post of our coding series. I’ve enjoyed being your resident geek and informing you about the array of Google codes that will make your online advertising life a breeze. Coding Series: Part 5 is all about micro-conversions–those small but still significant steps that contribute to the main conversion process. Micro-conversions can be tracked in Google Analytics with the Event Tracking tool.
Benefits: Event Tracking
Event Tracking is an object or data-oriented model that allows you to understand how users interact with certain web page objects, such as file downloads, Flash videos, page gadgets, buttons, the Google +1 button, links, and the like. All interaction with these web page objects can be tracked, including load times, downloads, and clicks, meaning the names you assign to user actions or behaviors is highly important and must be unique for reporting purposes. Event Tracking is useful for tracking user activities that don’t require visiting a new page of your website.
How It Works: Event Tracking
Event Tracking is another layer of data wherein you attach a method call to a particular website element in the Analytics JavaScript code. Then the UI (user interface) information can be tracked and recorded in the Events section of Google Analytics. In order to set up Event Tracking, you must have the ga.js tracking code installed on the pages where the event to be tracked is located.
How about a real-world example? Let’s say Walmart.com wants to track when people click the “Find a Store” button after entering a zip code in the store search box. Clicking this button runs a query and opens a popup window rather than changing the page URL. This action cannot easily be tracked with traditional Google Analytics script, making it a perfect candidate for event tracking.
Here’s the code for the “Find a Store” button:
<div style=”margin-top:10px”><input src=”https://i2.walmartimages.com/i/if/spacer.gif” class=”mainSpriteBTN FindBtn” type=”image” alt=”Find a Store” onclick=”WALMART[‘widget’].G0041s3DropDown.clickSafeOn()”></div>
Let’s define some Event Tracking parameters:
Category: Form
Action: Submit
Label: Store Search
Using these parameters, the Event Tracking code would be:
onClick=”_gaq.push([‘_trackEvent’, ‘Form’, ‘Submit’, ‘Store Search’]);”
And the revised submit button code is:
<div style=”margin-top:10px”><input src=”https://i2.walmartimages.com/i/if/spacer.gif” class=”mainSpriteBTN FindBtn” type=”image” alt=”Find a Store” onClick=”_gaq.push([‘_trackEvent’, ‘Form’, ‘Submit’, ‘Store Search’]);” onclick=”WALMART[‘widget’].G0041s3DropDown.clickSafeOn()”></div>
Where you place the Event Tracking code isn’t crucial as long as it’s within the list of parameters for a given object.
Code Implementation: Event Tracking
Follow these steps to set up Event Tracking on your website:
- Confirm you have tracking of Google Analytics installed on your site. If not, refer to Coding: Series Part 1.
- Then, call the _trackEvent() method in the source code of a page, video, or widget.
- Category (required) – The name assigned to the group of objects being tracked.
- Action (required) – A uniquely paired string that’s used to define the user interaction.
- Label (optional) – A string used for additional dimensions of the event.
- Value (optional) – A number used to assign numerical data to the event.
- Once Event Tracking has been set up and running for a day, view Event Tracking reports in the Content section of Google Analytics.
Event Tracking goes beyond what other tracking tools provide, giving you insight at a more granular level into how users are interacting with your website and what steps are being taken before the ultimate conversion is made. To find out more visit:
If you have any other questions about Event Tracking or how to set up links in the Google Analytics code snippet, Leverage Marketing’s Google certified team is ready to help!