Reputation: 13334
My pages are setup with multiple GA trackers:
ga('create', 'UA-XXXXX-1', {'name': 'tracker1','cookieName': 'tracker1', 'cookieDomain':'example.org'});
ga('tracker1.send', 'pageview');
ga('create', 'UA-XXXXX-2', {'name': 'tracker2','cookieName': 'tracker2', 'cookieDomain':'example.org'});
ga('tracker2.send', 'pageview');
ga('create', 'UA-XXXXX-3', {'name': 'tracker3','cookieName': 'tracker3', 'cookieDomain':'example.org'});
ga('tracker3.send', 'pageview');
In GTM, when I create Universal Analytics tags, I have the option to define the Tracker Name
, Cookie Name
, and Cookie Domain
:
Q1: Do I have to set those values, or will GTM figure those out automatically based on the Tracking ID
I provide in the Tag?
For the Tracker name
, the GTM UI reads:
Use of named trackers is highly discouraged in GTM
and points to a help page advising to use the Data Layer instead:
https://developers.google.com/tag-manager/android/v3/reference/com/google/tagmanager/DataLayer
which says:
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've looked around but couldn't find any GTM
DataLayer
syntax specific for defining tracker names.
Q2: Does someone have an example of what that syntax would be?
Upvotes: 0
Views: 1826
Reputation: 32760
To answer this at least partly:
Since I was curious about this as well I did a quick test and created two Analytics tags with different account ids. Looking at the GA debugger I got the output
Creating new tracker: gtm1403770664990
....
Creating new tracker: gtm1403770664991
and if I do trackers = ga.getAll() I get two differently named trackers as well. So I'd say GTM automatically names the trackers and you do not need to enter a name yourself.
Cookie domain will be the same for both (since they track the same domain).
The one thing I'm not sure about is the cookie name - only one cookie is created, but since this holds no info except for the client id it might very well be that this is not a problem and both trackers can user the same cookie/client id (I do not see how this would cause problems since the only requirement for the client id is that it is unique per user, which is the case even if multiple trackers use the same client id).
Upvotes: 1