Autotrack

Autotrack

Autotrack: Google’s new solution for analytics

Autotrack

To keep up to the ever changing web, Google released the JavaScript library Autotrack.js for analytics, a new solution for developers to track the user interactions that are common to most websites.

As Philip Walton, a Developer Programs Engineer at Google wrote in a blog post, “the web of today is much more complex and varied than it used to be. In addition to traditional, static websites, we have full-featured web applications. User interactions aren't limited to clicking links and submitting forms, and a "pageview" doesn't always mean a full-page load”.

Pageview hits are sent to Google Analytics by the default tracking snippet when a web page is first loaded, however, if you want to track user’s interactions, web developers have to spend time writing code to capture that information, and since digital strategist or website owners care about the same type of user interactions, web developers end up writing the same code many times for every site they built with little interest in learning further about what Google Analytics can do to get the most out of it.

Autotrack JavaScript library was created to solve this problem. It provides default tracking for the interactions most of us care about, requiring minimal manual implementation from web developers.

According to Walton in Google Analytics Blog, some of the features Autotrack enables are:

  • Outbound link and form tracking

With the default tracking code, if a user clicks a link or submits a form to an external domain, that action is not captured unless you specifically tell Google Analytics what happened.

Historically, outbound link and form tracking has been tricky to implement because most browsers stop executing JavaScript on the current page once a new page starts to load. But now, with Autotrack you can get outbound link and form tracking for free!

  • URL change tracking for single page applications

If you're building a single page application (SPA), that dynamically loads content and updates the URL using the History API, the default tracking code will not suffice and there can be complications.

Autotrack automatically detects URL changes made via the History API and tracks those as page views, also it keeps the tracker in sync with the updated URL so all subsequent hits (events, social interactions, etc.) are associated with the correct URL.

  • Declarative event tracking:

Sometimes it's easier for developers to declaratively add an event to the HTML than to manually write an event listener in JavaScript. Tracking simple click events is a prime example of this. So, to track click events with Autotrack, is just needed to add data attributes to your markup. As the following example:

<button data-event-category="Video" data-event-action="play">Play</button>

When a user clicks on the above button, an event with the corresponding category and action (and, optionally, label and value) is sent to Google Analytics.

  • Media query tracking:

Most sites today use responsive design to update the page layout based on the screen size or capabilities of the user's device. If media queries are used to modify the look or functionality of a page, then, it's important to capture that information to better understand how usage differs when different media queries are active.

With Autotrack library, now is possible to register the set of media queries you’re using, allowing you to see breakpoints, resolution, and even orientation data of your user’s devices, as well as when those values change.

Similarly, the solution also features enhanced session duration tracking and automatic and enhanced declarative social tracking. If you need a complete list of all plugins and instructions on how to use them, check out the Autotrack documentation on Github.

But, who can use Autotrack?

Well, anyone can use it to track their sites, but the library is optimized for sites that don’t customize their current implementations.

So, if you’re just starting to use the default tracking snippet, you should give it a try! If it’s not your case, you should check out first the documentation with your development team, to make sure none of the Autotrack features will conflict and no data will be double-counted.

Currently, Autotrack library is not an official Google Analytics product and is not covered by Google Analytics Premium support, but, it is a starting point in the creation of a feasible analytics solution; as it is open source, developers can give suggestions, provide feedback and understand how advanced features work.

This new update in Google Analytics portfolio, opens a spectrum of full and easy approachable possibilities for future insights that you and your web development team can use to leverage the way data-driven decisions are made, and for free!

As Frank Sinatra says: the best is yet to come.

If you like my articles,