Created
October 16, 2020 03:35
-
-
Save chavesm/2d2ac3d7f29ded3fe476ef03d2cb2049 to your computer and use it in GitHub Desktop.
Check if Google Analytics is Loaded (based on Mozilla article https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Privacy/Tracking_Protection)
This file contains 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
// Put far down in footer as possible. | |
setTimeout(function() { | |
if (window.ga && ga.loaded) { | |
console.log('GA is loaded.'); | |
} else { | |
console.log('GA is NOT loaded.'); | |
// Maybe do more interesting things here. | |
} | |
}, 5000); // Give time for the page to load. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment