As a site administrator, I want to use named trackers so that I can use two google analytics accounts running on the same page. For example: One account for the client, and one account for the digital agency that serves the client. The agency's tracker is from google tag manager, is unnamed, and I cannot name it. I want to be able to name the client's tracker, so that page views and other data don't get double counted.

I tried to create a named tracker based on https://developers.google.com/analytics/devguides/collection/analyticsjs...
I got this error:
Create only field name name is a disallowed field name. Changing the Tracker Name is currently not supported.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ben833 created an issue. See original summary.

ben833’s picture

Uploaded a patch that covers basic functionality. Upcoming patch handles advanced features too.

ben833’s picture

Including "send" commands in JS file

hass’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

I‘m still wondering why we need this... no idea. Only a second tracker need to have a name.

ben833’s picture

Issue summary: View changes

I updated the Summary to show why this is needed. Also, this is for 7.x not 8.x. Thank you for maintaining this module!

hass’s picture

First we always need to implement d8 to prevent regressions, than we backport.

What you describe above is already possible. The first tracker do not need to have a name - as I know. The second or third need to have other names to prevent the conflict. This allows all you are looking for... the first tracker is automatically named „default“ ga internally. If there is no reason I may missed, naming the first tracker is really not needed. The name is not visible in your ga account, too.

If you have other information let me know, please.

I know the create field error message... maybe we should change the text.

ben833’s picture

Issue summary: View changes

Ah true, but I should specify one more detail. The agency's tracker is from google tag manager, is unnamed, and I cannot name it because it's outside of my department. Therefore I need to name the one that is for the client, which comes from this module.

hass’s picture

I'm not aware that this causes a conflict? You can just enter the second tracker UA code into this module and you should be done.

ben833’s picture

Well there are a lot of function calls throughout the code like ga('send') that would use the account that doesn't have a name. I need it to be like ga('xyz.send') for my tracker named xyz. Otherwise my page views, click tracks, etc. get double counted.

hass’s picture

Can you name an example website where I can review this inreal life, please? Please also tell me what module is used for google tag manager.

hass’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

I think there is nothing to do as the base tracker do not need to be prefixed, only the second and more.