Confirmed users
9,624
edits
(Created page with "Google Analytics Events Tracking ‘Events’ in GA are any interaction you want to track that isn’t recorded as a pageview (i.e. the user does something, or we do something...") |
No edit summary |
||
Line 1: | Line 1: | ||
Google Analytics Events Tracking | =Google Analytics Events Tracking= | ||
‘Events’ in GA are any interaction you want to track that isn’t recorded as a pageview (i.e. the user does something, or we do something, but the URL they are on doesn’t change). | ‘Events’ in GA are any interaction you want to track that isn’t recorded as a pageview (i.e. the user does something, or we do something, but the URL they are on doesn’t change). | ||
By default, GA records page loads. Everything else we want to track needs to be ‘logged’ as a custom 'Event' by firing some extra JavaScript. | By default, GA records page loads. Everything else we want to track needs to be ‘logged’ as a custom 'Event' by firing some extra JavaScript. | ||
=== Guidelines for tracking events | === Guidelines for tracking events === | ||
== If in doubt, track more events rather than less. | If in doubt, track more events rather than less. <br> | ||
Tracking events is cheap (just a few additional lines of code throughout an app) but it adds a wealth of data to our records. | Tracking events is cheap (just a few additional lines of code throughout an app) but it adds a wealth of data to our records. | ||
== Never track personal information | == Never track personal information == | ||
This applies to all GA tracking, but double check you don’t log any email addresses or user_ids in event descriptions for example. | This applies to all GA tracking, but double check you don’t log any email addresses or user_ids in event descriptions for example. | ||
== Distinguish between events driven by the user, and events driven by us | == Distinguish between events driven by the user, and events driven by us == | ||
If an event is driven by us, e.g. displaying an alert or sign-up prompt with JavaScript, this should be recorded as a ‘non-interaction’ event because events are part of the bounce-rate calculation. | If an event is driven by us, e.g. displaying an alert or sign-up prompt with JavaScript, this should be recorded as a ‘non-interaction’ event because events are part of the bounce-rate calculation. | ||
A) If a user does something active on the site, like editing a page in Thimble, they should not be attributed as a bounced visit just because they stayed on a single URL while on the site. | * A) If a user does something active on the site, like editing a page in Thimble, they should not be attributed as a bounced visit just because they stayed on a single URL while on the site. | ||
B) However, sometimes we want to record events for our analysis that are driven by us (such as displaying an alert, or auto playing something on a page), and this is not driven by the user; these are ‘non-interaction’ events. | * B) However, sometimes we want to record events for our analysis that are driven by us (such as displaying an alert, or auto playing something on a page), and this is not driven by the user; these are ‘non-interaction’ events. | ||
== Naming convention | == Naming convention == | ||
Events have 3 levels of naming: category > action > label | Events have 3 levels of naming: category > action > label | ||
This allows us to record quite granular data, and do all sorts of analysis later (e.g. complexity of popcorn videos made by referring URL) | This allows us to record quite granular data, and do all sorts of analysis later (e.g. complexity of popcorn videos made by referring URL) | ||
I've suggested a way to name these for webmaker in a seperate pad. | I've suggested a way to name these for webmaker in a seperate pad. | ||
https://etherpad.mozilla.org/webmaker-ga-events-naming-convention | https://etherpad.mozilla.org/webmaker-ga-events-naming-convention | ||
== Annotations (being a good GA citizen) | == Annotations (being a good GA citizen) == | ||
When you add new GA tracking like Events to any property, it’s helpful to add an annotation in GA so people looking at reports no why a new event suddenly appears/disappears in the data. If you have reporting access you can do this directly, or note the change and the date for someone else to add. | When you add new GA tracking like Events to any property, it’s helpful to add an annotation in GA so people looking at reports no why a new event suddenly appears/disappears in the data. If you have reporting access you can do this directly, or note the change and the date for someone else to add. | ||
== Dev Guides | == Dev Guides == | ||
Tracking events using the old GA tag: | Tracking events using the old GA tag: | ||
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide | https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide | ||
Tracking events using the new GA analytics.js tag: | Tracking events using the new GA analytics.js tag: | ||
https://developers.google.com/analytics/devguides/collection/analyticsjs/events | https://developers.google.com/analytics/devguides/collection/analyticsjs/events |