Created
December 11, 2017 15:39
-
-
Save crmpicco/aec8e54ea9378e748e3c8df882202d2e to your computer and use it in GitHub Desktop.
Google Analytics - Send event to multiple trackers
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
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