2

We have an old site were, for various reasons, we need to move from implementing the GA tracking on-page to doing it through GTM.

The issue is that there are about 50-60 of the on-page ga event pushes that I am not wild about migrating.

The obvious work around is setting the name of the tracker in GTM. This solves the problem immediately but is highly discouraged according to Google and other sources.

Tracker Name: Allows you to name the tracker object yourself. Note: Naming the tracker object yourself is discouraged. If you inadvertently reuse an existing tracker object name, your data may become corrupted. Although providing a name for the tracker can allow you to share state between Google Tag Manager-created trackers and your pre-existing Google Analytics code, you should instead update the code on your site to use the Google Tag Manager dataLayer syntax. Otherwise you will be unable to configure your tracking via Google Tag Manager.

I'd like to know how "If you inadvertently reuse an existing tracker object name" happens and under what circumstances?

All you need to do is set "Set Tracker Name" to True. You don't even need to put a name in.
How would I then reuse the name?
Would this be if I am creating another GA tag in the same container and I also set the "Set Tracker Name" to true?
Or could this just happen by some kind of fluke one time when the code loads on the page?

Could someone ELI5?

  • "explain like I'm five" for anyone else having to look up "ELI5". – Stephen Ostermiller May 20 '17 at 9:41
1

All you need to do is set "Set Tracker Name" to True. You don't even need to put a name in. How would I then reuse the name?

This will make the tag not work. I.e. GTM will say it fires but if you use the GA Debug Extension the console will show you the error that the tracker couldn't be initialized.

Generally naming the tracker is discouraged because it's easy to make a mistake and break the tag. For instance you can't have hyphens in your tracker name.

E.g.

  • myCoolTrackerName -- works
  • my-cool-tracker-name -- doesn't work

I work at an agency and our standard practice is to name the tracker. This has helped especially when dealing with single page applications where the pagePath or pageTitle would often be screwed up, but maintaining the same tracker name solved that.

The rule of thumb is this: you can only have ONE UA code initialized per named tracker.

It doesn't matter how many event tags, pageview tags, transaction tags, etc you fire against the same tracker as long as the tags all have the same UA-code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.