-
Notifications
You must be signed in to change notification settings - Fork 45
Document issue with loading #7
Copy link
Copy link
Closed
Description
This code sometimes ran before GA was loaded:
/*
* Determine which version of GA is being used
* "ga", "_gaq", and "dataLayer" are the possible globals
*/
if (typeof ga === "function") {
universalGA = true;
}
if (typeof _gaq !== "undefined" && typeof _gaq.push === "function") {
classicGA = true;
}
if (typeof dataLayer !== "undefined" && typeof dataLayer.push === "function") {
googleTagManager = true;
}I don't understand why not to put it in init() and ask people to call init() as:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX', 'xxxxxxxxxxxxxxxx');
ga('send', 'pageview');
ga(function() {
riveted.init();
});
(which I did too, just to be safe), but at least document that riveted should be loaded after GA, violating their instruction to be loaded last on the page.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels