Event Tracking is a must have on the to-do list of any data driven Ecommerce business. Just by adding an extra code snippet, it enables you collect data on additional website actions and activities that are not ordinarily tracked with standard Google Analytics code.
From clicks on buttons (add to cart, view product, proceed to checkout, etc.) or links (internal and external), to what fields of the checkout form are filled and what errors users experience when they navigate through your store.
I intend covering Event Tracking with Google Analytics Universal in this post.
First off, Event Tracking fundamentally works through passing the following information to Google Analytics:
This data is also completely customisable – as you’ll get to choose the event Category, Action (Label, Value) specific to each activity to pass through to Google Analytics.
The data comes under the Behavior Report in Google Analytics:
Before deciding on how to label the activities in your store, take a look at how information is likely to be accessed.
This is where grouping Actions applies: as you will want to group similar activities like ‘clicks’ together as a single action that can be broken down by category and labels, rather than having too many varying actions.
In a similar vein with Categories, try to find ways to group and analyse similar categories like ‘buttons’ together with the ability to break them down by labels and actions.
Broken down to its bare bones, the code is structured like:
ga('send', 'event', category, action, opt_label, opt_value);
Replace each aspect (except ‘send’, ‘event’) with the actions that you’d like tracked and parsed to Google Analytics. Although you only need to include Category and Action, the other two are optional.
As an example, to track clicks on Add to Cart events, I am going to assign:
The important point to note, is that if you want the Event to fire when someone clicks something, you will need to put the code inside an onClick function, like:
onClick="ga('send', 'event', 'All Brands', 'Add to Cart', '23499');"
In this example, we’re tracking clicks on add to cart buttons, so the full code of button will look like:
<input type="button" onClick="ga('send', 'event', 'All Brands', 'Add to Cart', '23499');" button=”Add to Cart”> Product 23499 </a>
You can see how the extra line of code sits within the ‘Add to Cart’ button code and how reusable it is after a single implementation.
And because it is JavaScript, dynamic data insertion is possible, (as against static data).
In this example you would have to define the event ‘Category: Page Category or URL’ and event ‘Label: Product SKU’ variables elsewhere in the code, so that the JavaScript knows which bit of information to pull in.
This way when you look at the Google Analytics report you are able to see the number of times a specific product was added to cart and from what page (if the same product can be added from multiple locations).
You can go even further and compare product-to-cart data against your eCommerce report and calculate the conversion rate of all products added to cart (i.e. what percentage of products added to cart products of each type (SKU) have made it actual purchase). This could help improve your shopping cart user experience or identify products with issues such as high shipping rates.
As with goals and ecommerce data, adding a tangible value to your reports can give you so much more performance and progress insights, so it is highly recommended setting values wherever possible.
In Event Tracking code, the value is an integer that can be used for whatever metric you want, as long as it’s a positive number.
You can either set the value based on:
ga('send', {
'hitType': 'event',
'eventCategory': 'product1',
'eventAction': 'add-to-cart',
'eventLabel': 'prodcuct-category1',
'eventValue': 150.99 //150.99 is the monetary value of the product that is added to cart
});
Using either method here will then give you a much better idea of performance, especially when tracking more than one Event type.
ga('send', {
'hitType': 'event',
'eventCategory': 'video',
'eventAction': 'watch',
'eventLabel': 'home-credo',
'eventValue': 20.21 //20.21 is the amount of time that video was watched
});
Alternatively, you may choose to use the value field for another metric such as time (for tracking videos watched or time on site)
ga('send', {
'hitType': 'event',
'eventCategory': 'keyword',
'eventAction': 'search',
'eventLabel': 'brand-name',
'eventValue': 4 //4 is the rank of that specific keyword
});
Or as search engines positions or rankings. If you use these then you may want to make sure that everyone able to view reports in your Google Analytics account is aware that these values are not monetary values.
With Event Tracking you can collect insightful data and use it in many ways to measure your business’s performance and improve the results. However, before setting up Event Tracking (as well as any other type of data collection), answer the following fundamental questions:
Event Tracking is a must have on the to-do list of any data driven Ecommerce business. Just by adding an extra code snippet, it enables you collect data on additional website actions and activities that are not ordinarily tracked with standard Google Analytics code.
From clicks on buttons (add to cart, view product, proceed to checkout, etc.) or links (internal and external), to what fields of the checkout form are filled and what errors users experience when they navigate through your store.
I intend covering Event Tracking with Google Analytics Universal in this post.
First off, Event Tracking fundamentally works through passing the following information to Google Analytics:
This data is also completely customisable – as you’ll get to choose the event Category, Action (Label, Value) specific to each activity to pass through to Google Analytics.
The data comes under the Behavior Report in Google Analytics:
Before deciding on how to label the activities in your store, take a look at how information is likely to be accessed.
This is where grouping Actions applies: as you will want to group similar activities like ‘clicks’ together as a single action that can be broken down by category and labels, rather than having too many varying actions.
In a similar vein with Categories, try to find ways to group and analyse similar categories like ‘buttons’ together with the ability to break them down by labels and actions.
Broken down to its bare bones, the code is structured like:
ga('send', 'event', category, action, opt_label, opt_value);
Replace each aspect (except ‘send’, ‘event’) with the actions that you’d like tracked and parsed to Google Analytics. Although you only need to include Category and Action, the other two are optional.
As an example, to track clicks on Add to Cart events, I am going to assign:
The important point to note, is that if you want the Event to fire when someone clicks something, you will need to put the code inside an onClick function, like:
onClick="ga('send', 'event', 'All Brands', 'Add to Cart', '23499');"
In this example, we’re tracking clicks on add to cart buttons, so the full code of button will look like:
<input type="button" onClick="ga('send', 'event', 'All Brands', 'Add to Cart', '23499');" button=”Add to Cart”> Product 23499 </a>
You can see how the extra line of code sits within the ‘Add to Cart’ button code and how reusable it is after a single implementation.
And because it is JavaScript, dynamic data insertion is possible, (as against static data).
In this example you would have to define the event ‘Category: Page Category or URL’ and event ‘Label: Product SKU’ variables elsewhere in the code, so that the JavaScript knows which bit of information to pull in.
This way when you look at the Google Analytics report you are able to see the number of times a specific product was added to cart and from what page (if the same product can be added from multiple locations).
You can go even further and compare product-to-cart data against your eCommerce report and calculate the conversion rate of all products added to cart (i.e. what percentage of products added to cart products of each type (SKU) have made it actual purchase). This could help improve your shopping cart user experience or identify products with issues such as high shipping rates.
As with goals and ecommerce data, adding a tangible value to your reports can give you so much more performance and progress insights, so it is highly recommended setting values wherever possible.
In Event Tracking code, the value is an integer that can be used for whatever metric you want, as long as it’s a positive number.
You can either set the value based on:
ga('send', {
'hitType': 'event',
'eventCategory': 'product1',
'eventAction': 'add-to-cart',
'eventLabel': 'prodcuct-category1',
'eventValue': 150.99 //150.99 is the monetary value of the product that is added to cart
});
Using either method here will then give you a much better idea of performance, especially when tracking more than one Event type.
ga('send', {
'hitType': 'event',
'eventCategory': 'video',
'eventAction': 'watch',
'eventLabel': 'home-credo',
'eventValue': 20.21 //20.21 is the amount of time that video was watched
});
Alternatively, you may choose to use the value field for another metric such as time (for tracking videos watched or time on site)
ga('send', {
'hitType': 'event',
'eventCategory': 'keyword',
'eventAction': 'search',
'eventLabel': 'brand-name',
'eventValue': 4 //4 is the rank of that specific keyword
});
Or as search engines positions or rankings. If you use these then you may want to make sure that everyone able to view reports in your Google Analytics account is aware that these values are not monetary values.
With Event Tracking you can collect insightful data and use it in many ways to measure your business’s performance and improve the results. However, before setting up Event Tracking (as well as any other type of data collection), answer the following fundamental questions: