Last active
July 1, 2018 14:38
-
-
Save ptz0n/9892262 to your computer and use it in GitHub Desktop.
Google Analytics - Universal or Legacy?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check whether we have the legacy or universal lib available | |
* | |
* https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs | |
* | |
*/ | |
if(typeof _gaq !== 'undefined') { | |
console.log('ga.js'); // or via GTM? | |
} | |
else if(typeof ga !== 'undefined') { | |
console.log('analytics.js'); | |
} | |
else { | |
// No GA available on page :( | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment