Cross-Domain Tracking With Google Tag Manager


Keep calm and _setAllowLinker onUPDATE: Looking for instructions on cross-domain tracking with the new version of Google Tag Manager? Check here:

Cross Domain Tracking with Google Tag Manager (V2)

Cross-domain tracking has been the bane of any analyst’s experience for, oh, just about ever. It is probably the hardest thing to get right in a Google Analytics implementation, and in our experience, more people ask us for help with this one issue than any other.

Over the years we’ve dealt with this problem in different ways. jQuery made it easy to drop in a couple lines of code to track behavior across domains, but even then it wasn’t exactly automatic.

Then along came Universal Analytics and Google Tag Manager – the perfect 1-2 punch combo to knock out cross domain tracking once and for all. We held a webinar to show people step-by-step how to implement cross-domain tracking in Google Tag Manager. Below is a recording of the webinar, along with the written step-by-step instructions.

*NOTE: Since the webinar, there have been some updates to Google Tag Manager and Universal Analytics that make cross domain tracking even easier and more intuitive. If you follow the directions in the webinar, it will still work. But the written instructions below are up to date with the newest features.

Step-By-Step Instructions – Universal Analytics

The following instructions will guide you to setting up cross-domain tracking through Google Tag Manager with Universal Analytics.

Create the following macros

1. uaid


* For the value, replace the Xs and Yx above with your UA number.

2. cross domains

cross domains macro

3. element url (if you don’t already have it)

element url


Tagging cross-domain links

Create a tag for your Universal Analytics tracker (I recommend naming it Google Analytics – Universal). The Track Type for this tag should be Page View. If you already have a tag for Universal Analytics, modify it to match the following settings:

1. For Tracking ID, use your uaid macro

tracking id

2. Under More Settings > Cookie Configuration, set the value of Cookie Domain to auto.

auto cookie domain

* This step has changed since the webinar was recorded. In the webinar we say to create and use a {{top level domain}} macro for the Cookie Domain value. Now you can simply use auto, as pictured above.


3. Under More Settings > Cross Domain Tracking, set the value of Auto Link Domains to your cross domains macro, and set the Allow Linker drop down menu to True.

auto link domains

* This step has changed since the webinar was recorded. You used to have to go into Fields to Set, and add a Field Name of allowLinker with a value of true. Now you can just use the drop down menu pictured above.


4. Set the firing rule for this tag to All pages.

all pages

Tagging cross-domain forms

1. Create tag – name it Form Submit

form submit


2. Create tag – name it Cross-Domain – Forms

A. Create a copy of your Google Analytics – Universal tag. To do this, click on your Google Analytics – Universal tag and scroll to the bottom. In the lower right corner, click on the Copy this tag button.

B. Name your new copy Cross-Domain – Forms.

C. Change the Track Type to Decorate Form.

decorate form


D. Remove the All pages rule and add the following 2 rules (which you will need to create):

i. On Form Submit to

form submit rule 1

ii. On Form Submit to

form submit rule 2


Update web property settings

Go into your Google Analytics Admin settings. Under Property Settings, Tracking Info > Referral Exclusion List, add both sites (if not already added).

referral exclusions



Jim Gianoglio is a Manager for the Analytics & Insight department. He works with implementation, analysis and training of Google Analytics and Google Tag Manager. Before focusing on analytics, he led the SEO campaigns of Fortune 500 companies in the insurance, retail and CPG industries. Things you didn’t know about Jim: he’s biked from Pittsburgh to Washington DC in 41 hours, roasts coffee beans and has done voiceovers for TV commercials.

  • Was wondering, why not just use the autolink feature? Have you done some tests already?

  • @Dries –

    This implementation does take advantage of the autolink feature (through GTM). That’s why we don’t have to use a “Decorate Link” tag – just a “Decorate Form” tag. The link tagging is all done through the standard “Page View” tag with auto link features enabled through the More Settings > Cross Domain Tracking settings.

  • Hi,

    Is it possible to auto track GET forms instead of POST forms?

  • @Rick –

    The form submit auto event listener will work regardless of whether your form uses POST or GET.

    There are some edge cases we’ve seen where the form submit auto event listener doesn’t work (or can prevent your form from successfully submitting), but it’s not due to the method (POST/GET) you use to submit the form.

  • Dan

    Firstly thanks alot for taking the time to do your very helpful webinar!!!

    My question relates to using more than 2 domains.

    Say for example you had 2 separate websites each with their own domain & They each advertise a product. However the payment engine is on another site/domain ( a 3rd site, .

    I want to monitor cross domain tracking for each site, &, however I want to keep the tracking for & separate.

    Is this possible with Google Tag Manager.

    • @Dan –

      This is possible. You’d basically need to modify the uaid macro from the webinar/instructions above. Instead of using a Constant String type macro, you’d use a Custom JavaScript macro, with the return value being a web property ID based on either the hostname (if it’s or or based on the referrer (if you’re on

      You could try something like the following:

      function() {

      var ref = {{referrer}};

      if ({{top level domain}} == “” || ref.indexOf(“”)) {
      return “UA-XXXXXX-X”;
      else if ({{top level domain}} == “” || ref.indexOf(“”)) {
      return “UA-YYYYYY-Y”;
      else return “UA-ZZZZZZ-Z”;

      *Please test before implementing on a live site – this is merely provided as a possible solution (and was written rather quickly, so there may be typos!).

      This assumes that and are two completely separate sites that never link to each other (otherwise if a user clicked on a link from to, the wrong UA# would fire). It also assumes that the only way to get to is from either or If it is different, then the last else statement will at least catch those visits into a different account (useful for troubleshooting).

      This should at least get you started in the right direction.

  • What are the differences, if you want to implement cross-domain tracking with Google Analytics and not Universal Analytics?

    • @Gerard – If you’re using “classic” Google Analytics, the main changes are that you need to decorate your links in addition to decorating your forms. With Universal, the functionality to decorate the links is built into the standard tracking with the autoLink plugin (in GTM, this is set under More Settings > Cross Domain Tracking > Auto Link Domains).

      So for classic GA, you’d have an additional tag to listen for clicks on links (using the auto event listener), and another tag that would decorate those links if they went to the other domain. Your rules for this tag would be similar to the rules for the Cross-Domain – Forms tag.

      Hope that helps!

  • Thank you very much Jim!

  • Hi Jim,

    Thanks for the excellent blog post! I have a scenario where my main domain is on https site and the contact forms are on a third party http domain. I am trying to record the {{referrer}} in a form submit event, but seems to be stripping out the referrer info. Would your configuration listed above solve this issue?


  • @Ryan –

    If you’re sending someone from your form (on http) to your main site (different domain, on https) then the referrer should still be sent. It’s usually only the other way around (going from https to http) that the referrer request header is not sent.

    Is the problem that you have your http form iFramed on the https page? In that case, the referrer for the form would be blank.

    If that is the case, then the instructions in this post will not save you 🙁

    I would recommend this post:

  • Simon

    Hi Jim,

    Thanks for posting this.

    I have set this up and a query parameter is not being added to the URL.

    There are currently two analytics tags on the site I am working on, one served through GTM and one embedded into the HTML code. Would this prevent the query parameter from being created?


  • @Simon –

    There are some edge cases that can prevent the linker parameters from being added (especially with forms), and without knowing your specifics it’s hard to say exactly why they’re not being added.

    Having two sets of code – one through GTM and one manually added – will only make troubleshooting the issue more difficult, as well as lead to other issues.

    I’d recommend consolidating everything in GTM and then troubleshooting from there.

  • Nick

    Thanks Jim for posting this. I have everything working – the info is passing along in the url parameters and the visitor persists across one domain to another (so the cross-domain kicks in when a link goes to another domain) but the source is somehow not making it across. Instead it’s a self-referall (or instead of say

    Any clues as to what this might indicate?

    Thanks in advance for any info.


  • difeep

    Hi Jim, thanks for the awesome write up. I am assuming the debugger should return Running command: ga(gtmXXXXXXX.linker:autoLink,,, true, true) however, with my test, ga(gtmXXXXXXX.linker:autoLink,,, false, false) I only ever get false as the value.

    Both domains are using the the gtm code and GA profile id.

    Any thoughts as to why linking between the 2 different domains still fails to pass the cookie details?

  • @Nick – Do you have your own sites listed in the referral exclusion list? Look in the Admin, under the Property > Tracking Info > Referral Exclusion List. You should see your sites listed there. If they’re not, go ahead and add them.

    @difeep – The boolean values at the end of that command refer to the settings you have in GTM for your Universal Analytics pageview tracking tag. Under More Settings > Advanced Configuration > Cross Domain Tracking, you can set the Auto Link Domains, Use Hash (true/false), Decorate Forms (true/false) and Allow Linker (true/false).

    The “false, false” you’re seeing in the command refer to the Use Hash setting (the first false) and the Decorate Forms setting (the second false). In the webinar (and instructions in the post above) I showed how to set up tags for tracking form submits and and doing the necessary form decorations to pass the cookie. Of course, the awesome team working on GTM has since made it much simpler (by using the “true” setting for the Decorate Forms dropdown).

    If you’re not seeing the cookie pass back and forth, there could be a number of reasoons (AJAX forms, links that redirect, etc.). It’s hard to say without digging in deep to your site.

  • Syed

    Hi Jim, Many thanks for posting this useful information for us. I would like to link 5 domains for cross domain reporting. So I was wondering if I need to add 4 other sites using RegeX on the element URL field for 2.D.i And 2.D.ii like below:|||

  • Hi Jim,

    Thanks for this comprehensive method. I have a question that the Google forums were not able to respond and I wondered if you may be able to help me.

    We have 2 websites that use the same payment area, situated in the subdomain of has it’s own GA Profile and has it’s own too. We want top track them independently and be able to see how much traffic they send one an other. So we can’t add them to the referral exclusion list.

    Currently in the payment area we have 1 pageview tag for each profile and 1 ecommerce transaction tag for each profile too. The problem we are experiencing is that a new session is being started each time traffic is sent from to the payment area instead of just continuing the initial session. As a result is showing as the referral and the real pages from never show up in the reports as the landing page.

    Any help or ideas will be greatly appreciated.

  • Julian

    Hi Jim,

    I’ll much appreciate if you could post a quick pdf guide or update your post on cross-domain tracking with classic GA. Just for the dinosaures like me :/

    Great video and thanks for all the tips with GTM.


  • Petros

    Thank you for this post and the associated work of pulling it together.

    I am wondering how cross domain tracking works when you have multiple websites – some of which do not have GTM running at all. I manage 7 sites – all of which are intertwined. 3 have GTM installed. The others have regular async GA and one is still running Urchin!

    I am assuming that each site is treated individually — and that I need to get every site on GTM ASAP.

    Thanks again Jim!

  • @Syed –

    If you have 5 sites, then you’d need 5 tags:

    On form submit to
    On form submit to
    On form submit to
    On form submit to
    On form submit to

    Each one would be structured like the instructions above. You can’t just include all your domains as a RegEx for the element URL field. If you did it that way, you could potentially have a form post back to the same domain and it would trigger the cross domain form decoration which could cause some issues.

  • @Petros –

    Yes – if you want to do cross domain tracking across all 7 domains (without going insane) I’d highly recommend getting GTM on all of them and upgrading them all to Universal Analytics.

  • @Rafael –

    There may be some configurations that aren’t set up correctly – especially since you’re using two trackers on the payment page/site. Are you using named trackers?

  • Petros

    @Jim: That is what I assumed – and am working towards. At least I can set it up on sites that are running GTM. I am going to “hold out” and not succumb to political pressure for the others – especially the one running Urchin!

    PS Please implement a comment subscription plugin on this site. You have enough comments to make a business case for it – IMHO 😉

  • Petros

    Silly question @Jim. Is best practice to have a separate GTM container for each domain? Or can this be done using one container for all domains?

  • @Petros –

    I would recommend one container for all domains. It’s much easier to manage that way.

  • Hi Jim,

    thanks for the video guide.
    I have 1 question.
    I am setting up GA for company where I work and we are going to have a lot of domains.
    Example:,, …,,,… and so on (different country different domain for our set of webpages)

    Will your guide work on example like above? Do I need to add just the .eu domains in the cross domain macro or do I have to add all of the possible combinations of domains?

  • @Primož –

    You would need to add all possible combinations of domains to the {{cross domains}} macro. For example:,,,,,, etc.

  • Marcus

    Hi Jim,

    I’m trying to track visits from to should I enter just, into the cross domain macro?

    Or should I put,



  • @Marcus –

    You should put just the domains (without the subdomains) in the cross domain macro:,

  • Marcus

    Thanks Jim – really useful post.

  • Thanks for the great tutorial – I got stuck in just one place – and this has been reworked in any event for the cookie config – using auto works fine – but just a quick heads up for anyone struggling as I did using the script to which you link on the video – this basically takes the dot and takes the domain around that… so becomes
    My situation was on – so the script was returning – which the system then rejected….
    As I mention above, using “auto” as the value seems to fix the issue.

  • @Steve –

    Thanks for the heads up on that script! Definitely using the ‘auto’ configuration is the way to go.

  • Tyler

    Thank you!! This saved me hours.

    Just one question. Now when I link to from it adds a really ugly ga variable to the URL like this:

    Any idea how to get rid of it? Thanks again for the instructions!

  • @Tyler,

    That _ga parameter is how GA passes the cookie information for the visitor from one domain to the next – which is absolutely necessary for cross domain tracking to work.

    Keep in mind, it will only be there on the first page after clicking from one domain to the next (it doesn’t get added to the URL for every page).

  • Evan

    I have a situation where GA is not understanding a URL Percent-encoding so I can track multiple domains between my “source” domain and my “destination” domain. I’m using Google Tag Manager + the new Universal Analytics.

    Is there a macro or rule in google tag manager that I can create to help Google Analytics detect these two URL Percent-encoding as %2526 for & and %253d for = appropriately? If so, is there any support that could be provided with this issue I’m experiencing?

    Here is an example URL (not real):

    As you can see close to the tail end of URL contains my _ga cookie that originated from my “source” domain and is getting passed to my “destination” domain. This is a good thing, however GA is not able to read it, because of the URL Percent-encoding shown below:


    %2526 is a URL encode for &

    %253d is a URL encode for =

    Since google analytics is not able to translate the URL Percent-encoding %2526 and %253d it writes a brand new cookie instead when I look at my cookies when I debug using firebug > cookies tab.

    Thank you for the help in advance!


  • Evan

    I figured out a work around to my challenge (above) by writing some custom JS to look for the percent encoding in the URL and then append the entire cookie again to the URL this time with the proper &_ga= and the cross domain cookie. I was able to do this, because the cross domain cookie was already in the URL fortunately, but GA just couldn’t translate “%2526_ga%253d” as “&_ga=” which it now works perfectly with this script. However, it would be even better if GA could translate percent encoding in the URL without going to such length. Just a thought…

    note: with the regex on line 1, you would change it to match your own URL encoding issue.

    var mycookie =‘_ga%253d(.+)&wct=’);
    var url = window.location.href;
    if (url.indexOf(‘%2526_ga’) >= 0) {
    url += ‘&_ga=’ + mycookie[1]
    parent.location.hash = url
    var hash = location.hash.replace(‘#’, mycookie[1]);
    if(hash != ”) {
    location.hash = ‘&_ga=’ + mycookie[1];

  • @Evan –

    Sorry I wasn’t able to respond sooner! Looks like you worked this one out. Thanks for sharing your solution!

  • chaeyoung

    what if I want to know.. user is submit a form in destination domain?

  • Mike

    Hi Jim,

    Great article! We’ve set this up successfully using Tag Manger.

    It works fine for our subdomain to sales sub domain ie >

    However for external sites eg > we’re still seeing source/medium as, not ‘real referral site name’/ referral or organic, cpc, direct etc as we would expect.

    We’ve got Allow Linker set to True on the pageview Tag (Constant string) Value,

    We’ve set the macro used in the Auto Link Domains as the site names

    We can see pageviews from both domains in the Analytics view, so there tracking OK.

    Have you any suggestion on how to debug this?


  • @Mike –

    I would check two things:

    1. Do you have the sites added to your Referral Exclusion List in Google Analytics? (This is the final step listed in the blog post)

    2. For your cross domains macro (where you list your site names) are you using just the domain? Or the full domain (including subdomain)? It should be set to:,


    Also, there may be users whose source/medium was attributed to the self referral before you implemented cross domain tracking, and they keep coming back directly (direct navigation or bookmark). In this case, they will continue to show up as self referrals, because direct never overwrites existing source information.

  • Mike

    Hi Jim,

    1 Yes I have but as subdomains ie so have left as for now.

    2 Ah! Had all the subdomains set so have now removed these and set to

    Will give it a go!

  • samshare

    Hi Jim,
    Thanks your Post. but i have question need you help. there is ” Cross-Domain – Forms Not fired”
    Can you tell me the way i can fix it.

    Thanks Again!

  • The best explanation I’ve seen for cross-domain tracking in GTM…Thank you!

  • Hello,
    I want to track ecommerce data of my site. We are using for product information and cart. And we are using paypal for payment. Now GA will track when payment is successfully completed. I have enabled Ecommerce on GoogleAnalytics. And its working fine. The problem is when some one lands on our site through other medium, GA is not tracking that medium. Its giving our site name as medium.

    Can anyone help me. How do I solve this problem.?


  • I am having the same tracking issue Sneha is having. What I also noticed on my site is that the cross domain cookie (_ga=) would reset after the initial landing page. Any help you could provide here would be greatly appreciated.

  • Krystal

    My issue is similar to both Mike’s and Sneha and Dianne’s…

    The way our site is set up is it goes from > >

    Somewhere between and it is losing all tracking information, so our transactions come through as (referral) and (referral)…

    How can I resolve this so my utm’s will stay with it from landing to conversion? (I’ve gone through the webinar and read through the comments before posting…)


  • @Jim Wow 10/10 for replying & effort! Best posting on Cross domain & GTM
    @Marcus asked a good question, if I’m mostly cross sub.domain tracking do I just keep the {{cross domains}} to the one domain? ? or & and all using the same UA-XXXX and with GTM.
    Each subdomain has its own GTM container in order to keep it clean.
    If I’m sending traffic from > > Where should I be adding these steps? All three containers? Or just on
    Sadly do have a couple old classic GA sites with GTM but, can you point to an example / blog post that shows the old way of link decorator?
    Ps this has been more helpful than the google forum.

  • @Christopher –

    In your case, you’re not doing cross-domain tracking, just subdomain tracking. Since the users stay on the same domain, you don’t have to pass their cookies with them (since the cookies written from can be read by

    The only thing you need to do is make sure the cookies are being set to the highest level domain (in your example, this would be

    To do this with Universal Analytics and GTM, you can go into your Google Analytics tags and set the cookie configuration (under More Settings > Cookie Configuration). In the Cookie Domain field, type in “auto” (without the quotes). This sets the cookie to the highest level domain automatically.

    For Classic GA in GTM, this same setting is under More Settings > Domains and Directories > Domain Name. For this, you can’t just type in “auto”. You need to type in the highest level domain (i.e.

    This takes care of maintaining the cookie whenever a user goes from your main domain to a subdomain to any other subdomain.

    Just be sure to do this in all your analytics tags in all your containers.

  • @Krystal, @Dianne and @Sneha –

    Unfortunately, It’s hard to diagnose your specific issues without more information. There are a lot of things that can make cross domain tracking go awry, and without looking at your specific sites it’s hard to say what’s causing the problems.

  • Do you recommend using 1 container for multiple subdomains if each site at times will be analyzed independent from others?

    For simplicity we would love to have just one container/snippet. However, we are concerned about what the data will look like if we need to audit website marketing performance one day, and then analyze how clients are using the software on a subdomain the other. Google talks about setting up filters and views, but I am hesitant to make changes and then found out it isn’t what we wanted.


  • Anto777

    Dear Sir Madam,

    Thank you for the amazing post!

    What about the situation with multiple GA properties that each has a GTM container, is it possible to create an additional (Global) GA property and set all GTM containers to send all data additionally to the global property. At the moment we have additional specific tags that within each container that link to the global property id.

    Many thanks!

  • @Zach –
    You can use a single Google Tag Manager container on all domains, but still track them in separate Google Analtyics Web Properties. Just use a lookup table macro to return the correct Web Property ID (UA-12345-1, etc.) based on the hostname.

    Yes – rollup trackers are fairly common. You just need to include the GA tag for the rollup Web Property in all of your containers.

  • Hi,

    I have a problem with my tag manager tag that fires on the success page of my site. The data layer and everything works perf, but in Norway customers are re-directed to the acquirers payment site to confirm their payment, and when confirmed are re-directed back to our success page. The problem then are that when my universal analytics success page tag are firing, then the source of the customers session are re-set to the acquirers URL as a referral. Any clue how to avoid resetting the source of the customers session?

    Best regards,

    • @AlexanderAA –

      Universal Analytics works differently than “classic” Google Analytics when it comes to referrals. In the classic version, if the session hasn’t time out (30 minutes since the last interaction) referrals are ignored. So in your example, if users in Norway are taken off the site to confirm payment, then brought back to the site for the success page, that third-party payment site is ignored as a referral and does not overwrite the source/medium of the existing session.

      With Universal Analytics, on the other hand, each time the traffic source changes (e.g. coming back to the site from the third-party payment site) it generates a new session with new source information. To fix this, you can add the third-party payment site to the Referral Exclusion List. Here’s the documentation for doing that:

  • Hi Jim,

    We use a form system called Wufoo for some folks, and we embed the forms using javascript. I just received an answer to a ticket I submitted regarding submit handlers from Wufoo, and they’re not too optimistic with regard to google tag manager integration.

    I was wondering if there is a workaround for situations like this where the form is embedded via javascript, and the submission passes through a third-party server.



  • MacKenzie Rawcliffe

    I know you recommend using one container to do cross domain tracking – but if you don’t want to – will the cross domain tracking still work. Do you set it up the same way?

  • @Paul – if the form is being embedded in an iFrame (with the source of the form coming from then this will not work. I was playing around with the free version of Wufoo and the options to embed the form would not make it possible to track.

    The “JavaScript version” merely included a link to the form (which takes you off the site to the form page on So that wouldn’t work.

    The other option to embed was the iFrame version, which like I mentioned, also won’t work.

    Perhaps there are additional options with a paid account that I’m not aware of. But it doesn’t look like this is going to be easy for you – sorry!

  • @MacKenzie –

    You can still do cross-domain tracking with multiple containers. But now that the GTM interface has been redesigned, there are some changes to this post that need to be made to stay current.

    I’m working on updating this post – stay tuned!

  • Albina

    Hi Jim,

    adding sources like paypal or ogone to the referral exclusion list doesn’t help. They would still show as referring sources and be credited with the sales.

    Looking forward to your update.

    Thank you for the great work!


  • Hi Jim,

    Thanks for such an informative write up. The Google team hasn’t quite how to simplify this, so it’s greatly appreciated.

    I’ve tried to follow the steps you’ve outlined, along with a few other examples on the web and I keep running into the same problem;

    LP –
    Main Site –
    Funnel –

    Tracking sources pass cleanly from LP-to-Main but when I go from Main-to-Funnel the sources drop.

    Any ideas where I might be going wrong?

    I’ve got the cross domains defined as and

    I’m troubleshooting in real-time analytics with cpc as the utm_medium.

  • Hi Jim

    Thanks for a great explanation. We’ve included cross domain tracking & whilst this is working in terms of picking up clicks for a campaign, it is not linking in with the goals, instead being picked up as referrals. We have the referral included in the exclusion list so not entirely sure why that’s still occurring as it works well for all other campaigns.

    Any help would be greatly appreciated!

    Kind regards


  • @Ron, we’re experiencing exactly the same problem. At some point we lose all information about the source. I’ve noticed that there are 3 cookies stored:, (so without dot) and 2 first cookies store no data about the source ( (direct), (referral) or (none)) and this is the third one that stores the right source.

    Unfortunately in GA Real Time I see the right source at the beginning, but at some point (randomly or after ~5 minutes of inactivity) the source disappears and shows up as (direct), (referral) or (none).

    @Jim – maybe you have any thoughts?

  • Hi. Jim, I appreciate your efforts and way you reply all queries by readers, But my situation is bit different, Hi have to websites one is and another is ticketstoworld, both are different website, if any user search flights, hotel etc on he redirects to flight.ticketstoworld, and so on, these however pages are different on ttb and, So how to manage this situation, right now i want to use GTM only on for testing purpose. Thanks in Advance..

    Sandeep Kumar

  • Alexander

    Should i delete the old Universal Analytics tag from GTM first and then to insert this cross domain tracking tag? The old UA tag is active at this moment.

  • Hi Jim,

    Great post! I wanted to ask about the scenario where you want to see original referral source but also if it hit both of your websites.

    E.g. if someone came from Display and hit my first website, and then clicked on a link on there to go through to my second site.

    Based on your post, if I excluded self-referrals then I could see that the person hitting the second site came originally from display but would I still have sight of the fact they hit my other website first or is that information lost?


  • Excellent guide, Jim! One question: if I have more than one domain (different languages) and I need cross-domain tracking with my payment system, can I add them all as separate macros to the same tag?

    I assume that step 2. Cross-domains should countain, for example:, – Or can I add all the versions of my site right there? I.e.:,,,

    • Jim Gianoglio

      You can add all sites and ccTLD versions of your sites in the same macro/variable.

  • jevan

    Hi, what If I am using different containers for each site and I wanted to do cross domain tracking. Say has its own GTM container and has its own GTM container. How can I do the cross domain setting set up?

    • Jim Gianoglio

      You can still do cross domain tracking, you’ll just need to make sure that your GA tags in both containers are set up the same way. Specifically, they both need to have the allowLinker set to true (you’ll set this in the Fields to Set section in GTM V2), and for the Auto Link Domains field, you’ll just list the opposite domain. For example, in the container, you’ll list in the Auto Link Domains field, and vice versa.

  • Hi Jim,

    Any chance you can provide cross domain tracking using GTM V2 latest version? Thanks in advance

  • Chris Weaver

    Hi Jim, This is a great post and shows how important after 2 years how many comments you still get. I implemented correctly, but now adding another domain to the Cross Domain macro (variable now) and cannot get it working. Is there any additional steps needed when adding new domains to the cross domains list?

  • Jim Gianoglio

    Real-time reports unfortunately won’t help troubleshoot here, since they use last-click attribution (instead of last non-direct click attribution, as the standard reports use). Check your standard reports to see if your source information stays the same from domain A to domain B.

    Other things to check:
    Click the link on domain A to go to domain B. When you get to domain B, look at the URL in your web address bar – make sure you see the _ga cookie, and compare this value to your _ga cookie from domain A. They should be the same. If there is no _ga cookie being appended to the end of the URL, then you’ve found the problem!

  • Jim Gianoglio

    The same instructions above (and more recently, read our post for cross-domain tracking using GTM V2 – will apply to your situation. You just need to make sure you’re passing your _ga cookie as a parameter in the URL when a user goes from to

  • Jim Gianoglio

    You have it right – using cross-domain tracking, you’ll see the the person hitting the second site as coming originally from display.

  • Jim Gianoglio

    Real-time reports unfortunately won’t help troubleshoot here, since they use last-click attribution (instead of last non-direct click attribution, as the standard reports use). Check your standard reports to see if your source information stays the same from domain A to domain B.

    Other things to check:
    Click the link on domain A to go to domain B. When you get to domain B, look at the URL in your web address bar – make sure you see the _ga cookie, and compare this value to your _ga cookie from domain A. They should be the same. If there is no _ga cookie being appended to the end of the URL, then you’ve found the problem!

    Also, if you’re seeing multiple cookies being set, then you have some other issues to deal with. You probably have multiple trackers on the page with different cookie domain settings. This introduces additional complexities that you’ll need to consider.

  • Kelly Swanson

    This might have been answered but when doing Cross Domain Tracking to 1 Primary and 1 sub-domain in GA where one authenticates to another, how is the user ID feature implemented in the code on either site in order to maintain 1 user ID for the whole session?

    • Rutger Meekers

      I have the same question. Do you have an answer yet?

  • andrew.girard

    It seems that Tag Manager set up for cross domains has again changed since you last updated this. I actually have a tag set up, and it is tracking page views, but it’s not showing what domain each page view is from. I thought it may be the cookie configuration, but that doesn’t even seem to be an option anymore. Any idea what I may be missing? Any help is much appreciated! Thanks!

    • Jim Gianoglio

      Things have changed a bit with Google Tag Manager V2. We have an updated post that walks you through doing cross-domain tracking in the new version – it should answer your questions:

      • andrew.girard

        Thanks, I had actually just found your updated article when your replied! The article from annielytics also helped me to get this figured out. I had to set the filter in GA in order to add the domain in front of the pages. Thanks for your help!

Contact Us.

Follow Us



We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187