Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to Google Universal Analytics
This is an optimized version of the official Google Universal Analytics snippet, based on http://mathiasbynens.be/notes/async-analytics-snippet. The only difference is that this version still uses `document.getElementsByTagName('script')[0]` instead of `document.scripts[0]` for Firefox < 9 support. Unminified, optimized code: (function(window, document, script, variableName, scriptElement, firstScript) { window['GoogleAnalyticsObject'] = variableName; window[variableName] || (window[variableName] = function() { (window[variableName].q = window[variableName].q || []).push(arguments) }); window[variableName].l = +new Date; scriptElement = document.createElement(script); firstScript = document.getElementsByTagName(script)[0]; scriptElement.src = '//www.google-analytics.com/analytics.js'; firstScript.parentNode.insertBefore(scriptElement, firstScript) }(window, document, 'script', 'ga')); ga('create', 'UA-XXXX-Y'); ga('send', 'pageview'); Minified: (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;e=o.createElement(i);r=o.getElementsByTagName(i)[0];e.src='//www.google-analytics.com/analytics.js';r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));ga('create','UA-XXXX-Y');ga('send','pageview'); Closes #1347 and #1369.
- Loading branch information
48d49e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
function(b,o,i,l,e,r)
48d49e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏 👏 👏 👏 👏
48d49e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
48d49e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, glad to see you guys appreciate it :)
48d49e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you even changed the way the script src was being set to reduce the number of params being set. 👍