Skip to content

Instantly share code, notes, and snippets.

@chavesm
Created October 16, 2020 03:35
Show Gist options
  • Save chavesm/2d2ac3d7f29ded3fe476ef03d2cb2049 to your computer and use it in GitHub Desktop.
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)
// 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