Skip to content
This repository has been archived by the owner on Jul 25, 2019. It is now read-only.

GA commands now prefix their command name with the name of the GA tracker #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

harterc1
Copy link

GA commands now prefix their command name with the name of the GA tracker to handle cases when developers assign specific names to their trackers.

This branch is being used live at https://www.lonelyplanet.com/italy (Notice the video poster with the play button on it midway down the page -- it may take a moment to load after the page loads depending on your internet connection)

In the javascript console, notice that the following command doesn't work (Please don't run, or be careful as this is live GA data we're mucking with here):
ga("send", "pageview");

But this one will work because when we run ga("create", ..) earlier on, we assign a special tracker name to the object:
ga("tealium_0.send", "pageview");

…cker to handle cases when developers assign specific names to their trackers
if (window.ga && window.ga.getAll) {
trackers = ga.getAll();
if (trackers.length > 0) {
return trackers[0].get('name');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if you know - why would there be more than one tracker and should we fire events to all trackers?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants