Analytics
2.4K members online now
2.4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Drupal 7 GA module cross/multiple domain tracking uses double quotes

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Does it matter that single or double quotes are used for the domains?

 

According to the docs, for cross/multiple domain tracking to work the domains as well as 'require' and 'linker' should be in single quotes. Here's how it is on our site now, inserted via the GA module:

(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create", "UA-xxxxxxx-4", {"cookieDomain":"auto","allowLinker":true});ga("require", "linker");ga("linker:autoLink", ["mysite.org","www.mysite.org","www.mysite.org","xxx.mysite.org","my.mysite.org","xx.mysite.org","mysite.org"]);ga(... "pageview");

 

Google Tag Assistant errors with Unknown method name: 'linker:autoLink'

 

This is what's recommended, notice, single quotes. Is this a bug with the Drupal module or are double quotes allowed? If double quotes are ok then what does the unknown method name refer to?

 

Edit the tracking code on the secondary domain.
Find the create line in the snippet. Make the following changes to the snippet (the changes you need to make are inbold red text):
ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['example-1.com'] );
Remember to replace the example tracking ID (UA-XXXXXX-Y) with your own tracking ID, and replace the example primary domain (example-1.com) with your own primary domain name.
The tracking code snippet must contain these changes every place it appears on your secondary domain.
For three or more domains
Follow the example above, but add the other domains to the autoLink plugin. Even the additional comma here is important:
ga('linker:autoLink', ['example-1.com', 'example-3.com'] );

 

f

1 Expert replyverified_user

Re: Drupal 7 GA module cross/multiple domain tracking uses double quot

Top Contributor
# 2
Top Contributor
Hi,

double quotes should work just fine. Since the post altered the code - could you send the URL so that I can try and reproduce the tag assistant error?

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: Drupal 7 GA module cross/multiple domain tracking uses double quot

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
toolkit.centerforartsed.org

Re: Drupal 7 GA module cross/multiple domain tracking uses double quot

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
Drupal developers are saying this is a bug with the Google Tag Assistant please fix.