Google's new Autotrack library enables additional tracking of site visitor interactions
Recommended link: Google Analytics announcement about the Autorack plug-in
If you've been involved with customising Google Analytics for different businesses, you will know there are some oddities which make it difficult to track some on-site user interactions which are helpful to know. For example, how do you track clicks out to other sites or outbound form fills. These deficiencies have been around ever since the service was purchased from Urchin. However, there have been workarounds available as plug-ins which we have used on Smart Insights and when helping customise other sites.
Google's new Autotrack plugin library for the first time provides a quality, Google Authorised library providing a simple way to record 'clicks out' as events and also has some great new features which effectively mean it is '6 plug-ins in one'
Here's a quick run down of what's available in the new Autotrack library - available on Github - you can download the autotrack.js file to be hosted on your server from Github:
The six options in the GA Autotrack plugin
1. outboundLinkTracker. This automatically detects when links are clicked (when href attributes point to sites on different domains). These are recorded as Events, so you can see the popularity of clicks on outbound links in the Event category "Outbound Link", the event action is "click".
This will include links to subdomains on the same site, but this can be adjusted.
2. outboundFormTracker. This part of the plugin automatically detects when forms are submitted to sites on different domains and again records an event hit. The event category is "Outbound Form.
3. socialTracker. This is a useful new feature that automatically adds social tracking for the official Twitter tweet/follow buttons and the Facebook like button. We like this since it gives more information on the relative popularity of different posts shared via Twitter which was withdrawn recently. Of course it won't show retweets which happen off-site - just interactions on site.
If like we do, you include official Twitter or Facebook buttons on your page and you're using autotrack, user interactions with those buttons will be automatically tracked.
Notice that Google+ (or LinkedIn) isn't included!
4. eventTracker. This part of plugin adds declarative event tracking which means that it is easier to specify clicks on different content assets like promo buttons, panels, sliders or videos. . The attributes data-event-label and data-event-value are also supported (attribute names are customizable).
For example adding this element to an onClick action would record a click on a carousel or slider element.
Chevron-button data-event-category="carousel" data-event-action="panel-clicked">First CTA
5. sessionDurationTracker. Classically, session duration in Google Analytics is defined as the amount of time between the first and last hit of a session. For a session where a user visits just one page and then leaves, the session duration is zero, even if the user stayed on the page for several minutes. Even for sessions with multiple pageviews, it can still be a problem because the duration of the last pageview is usually not considered.
Google says that this part of the plugin partially solves this problem by sending an event hit to Google Analytics (in browsers that support navigator.sendBeacon) when the document is being unloaded. The event category is "Window" and the action is "unload".
You will need to take care if you report on duration to colleagues or clients since this will make a difference to average visit duration across the site.
6. urlChangeTracker. Finally and least valuable for most the urlChangeTracker plugin detects changes to the URL via the History API and automatically updates the tracker and sends additional pageviews.
This could be useful though if you have an application process e.g. a quote engine which has been built where each screen refresh to the next step refreshes the same URL. You will likely still need to use event tracking to review different steps.
So, those are the six options. Remember that by default, if you install autotrack.js source file this will enable all the options. You will have to follow the instructions on Github to customise the build if you want to exclude some.