Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
auto
to the GA tracker create method
The Google Universal Analytics now supports automatic cookie domain configuration simply by adding `auto` to the analytics tracker create method: `ga('create', 'UA-XXXX-Y', 'auto');`. From https://developers.google.com/analytics/devguides/collection/analyticsjs/domains#auto: "Automatic Cookie Domain Configuration simplifies cross domain tracking implementations by automatically writing cookies to the highest level domain possible when the auto parameter is used. When used on the domain www.example.co.uk, it will try to write cookies in the following order: 1. co.uk 2. example.co.uk 3. www.example.co.uk Analytics.js will fail to write a cookie on co.uk but will succeed on example.co.uk. Since a cookie was succesfully written on a higher level domain, www.example.co.uk will be skipped" So, when this parameter is omitted (as it was prior to this commit), Google Universal Analytics will default to using `location.hostname`, which will include the subdomain, preventing websites with multiple subdomains from being able to automatically track unique users across those subdomains. Note: The `auto` parameter is now officially part of the recommended Google Universal Analytics snippet. https://developers.google.com/analytics/devguides/collection/analyticsjs/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ref: https://developers.google.com/analytics/devguides/collection/analyticsjs/domains#auto Close: h5bp/html5-boilerplate#1562.
- Loading branch information