Universal Analytics Cross-Domain Tracking with Dynamic Tag Manager

Wow, that title is a mouthful. Let me get to the point. Cross-domain tracking for Universal Analytics with Dynamic Tag Manager is broken. I think. For those of you using Google Analytics with DTM and your cross-domain just isn’t working out: this post is for you. I spent several hours debugging some cross-domain tracking. What do you need to do to enable cross-domain tracking?

  1. Ensure you have added all of your domains in your “Edit Property” page in DTM (see below the “Publish” button, admins).
  2. Check the box that says “Allow Linker Link” in your Universal Analytics settings
  3. ???
  4. Profit

That’s it, really. Just 2 steps and it should work (once you have published the property). There are 2 things going wrong here. First of all, DTM doesn’t flag changes made on the web property level as something that needs a publish. It does. So if you have added multiple domains to your web property… publish your property. I guess this would matter if cross-domain tracking actually worked.

I was lied to. Debug mode told me that everything was functioning as intended…

DTM Cross-Domain Debug Mode

But when I clicked on any link going between domains there was nothing. My expectation was that I would see a query string that would look something like the following: url.com/?_ga=2131.123.1223.123

That common key (user/session ID) is what ties the sessions together. So how do you fix this? It’s quite simple, really.

  1. Go to your Google Analytics settings in DTM (that gear next to your tool info).
  2. Click on “Customize Page Code” and click “Open Editor”.
  3. Use the following code:

ga(‘yourtrackername.allowLinker’,true);
ga(‘yourtrackername.require’, ‘linker’);
ga(‘yourtrackername.linker:autoLink’, [“yoururl.com“, “yourotherurl.com“]);
return true;

“yourtrackername” is that hash string that’s in Customize Page Code drop-down.

“yoururl.com”/”yourotherurl.com” are the domains that you want to track across domains.

That should do it! If you’re experiencing the same issue I was, I hope this helps.

2 thoughts on “Universal Analytics Cross-Domain Tracking with Dynamic Tag Manager”

Leave a Comment