By knowing which links visitors use to leave the site on we can improve the layout and design to either keep them from leaving or in the case of affiliate links making sure they leave on the correct link.
1. Event Tracking Overview
The Event tracking concepts are pretty straigh forward. It consists of an onClick element that gets added to any <a> tag on your site.
onClick="_gaq.push(['_trackEvent', 'Category', 'Action', 'Label', 'Value']);"
The code can be broken into two parts
- Part 1: onClick="_gaq.push(['_trackEvent',
- Part 2: 'Category', 'Action', 'Label', 'Value']);"
Part 1 is the same on every page
Part 2 is customizable to best fit your site. Notice the second part has 4 variables:
These four variables are very helpful and can really help us make sense of the data in the Google Analytics Reports. More about these variables later.
Here are few helpful tips:
- Only Category and Action are required
- Category / Action / Label are all text based
- Value is numerical and helps establish a links value
- Think of Category / Action / Label as Parameter 1 / Parameter 2 / Parameter 3
2. Event Tracking Category Planning
Assigning the values for Category, Action, Label is an important step and should be planned out so that it is easy to create and interpret reports.
In this example we will assign the values for tracking outgoing affiliate links from different pages on a website. We are tracking multiple affiliates and multiple links to the same affiliate on the same page. Here is our setup:
Category = The Page Name = Homepage / Top Picks / Reviews
Action = Affiliate Company Name = SiteGround / HostGator /
Label = Location or Type of Link on the page = H3 Title / URL Link / Go button / Image
By organizing the parameters this way we can easily see how many links were clicked on a particular page, which affiliate got the most clicks, and which affiliate links the visitors clicked on.
3. Bringing it together
Original Code: onClick="_gaq.push(['_trackEvent', 'Category', 'Action', 'Label', 'Value']);"
Track a home page editor's top pick from the main table to HostGator
onclick="_gaq.push(['_trackEvent', 'Homepage', 'HostGator', 'Top Picks Table']);"
Track a home page editor's top pick from the main table to HostGator and the link click is worth $2.50
onclick="_gaq.push(['_trackEvent', 'Homepage', 'HostGator', 'Top Picks Table' '2.50']);"
4. Understanding the reporting
Now we have all the links have been added to your site you will need to wait a few day for data collection and then you can see which links on your pages are getting clicks and if the clicks are increasing or decreasing over time.
Also feel free to make any adjustments to the variables being used for tracking.
With patients and a clear plan you will learn a lot more about your visitors behavior.
5. Google Analytic Event Tracking Resources
Google Event Tracker Guide
Tool for creating Event tracking code