Skip to content

Instantly share code, notes, and snippets.

@crmpicco
Created December 11, 2017 15:39
Show Gist options
  • Save crmpicco/aec8e54ea9378e748e3c8df882202d2e to your computer and use it in GitHub Desktop.
Save crmpicco/aec8e54ea9378e748e3c8df882202d2e to your computer and use it in GitHub Desktop.
Google Analytics - Send event to multiple trackers
if ("ga" in window) {
// we have multiple trackers, one for region and one for global, so we need to iterate over each
// tracker and send the event data to each
trackers = ga.getAll();
$.each(trackers, function(i, tracker) {
if (tracker) {
tracker.send('event', category, action, label);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment