Two Steps to Correctly Tracking Subdomains in Google Analytics


Subdomains are a common fact of life on the web, and that means they’re a common fact of life in web analytics. Unfortunately, Google Analytics has a few hoops to jump through in order to track sessions across subdomains on the same domain. More unfortunately, the Google Analytics documentation is unclear on what hoops you need to jump through. If you have subdomains, it’s possible that you are tracking them correctly, but there are several reasons why your implementation may be less correct than you thought.

Review: What Is a Subdomain and How Should I Track It

If you have a webpage whose URL is, then is the “root domain” or “parent domain,” and is a “subdomain” of A single root domain can have any number of subdomains (even zero!), and website owners can use them however they want.

Most of the time, if a user moves from one subdomain to another on the same root domain, you would want to view their behavior as a single session in Google Analytics. This allows you to easily connect interactions that take place on the two different subdomains. For example, it allows you to credit a product promotion on with an ecommerce transaction on

This blog post will focus only on subdomains that share a root domain, like and If you have multiple root domains, like and, then you should check out our posts on cross-domain tracking.

How to Properly Implement Subdomain Tracking

There are two required steps to track a user across subdomains as a single session in Universal Analytics (these steps are different than Classic Google Analytics). One setting causes hits from different subdomains to properly be credited to the same user, and the other setting causes those hits to be processed as part of the same session.

There are two steps: 1) Set the Cookie Domain and 2) Update Your Referral Exclusion List.

Step 1: Set the Cookie Domain

On-page, set the Cookie Domain to ‘auto.’ This is the default setting for Universal Analytics, but must be explicitly set when implementing with Google Tag Manager. This allows hits from all subdomains to share the same first-party cookie, which allows Google Analytics to tell that they came from the same user.

If you use the recommended JavaScript snippet that Google Analytics provides you, this is already set for you!

Google Analytics Tracking Code

If you use Google Tag Manager, you have to add this yourself to your Google Analytics tag.


(Update: We highly recommend using a Google Analytics Settings variable, which now has this value set by default!)

The same implementation should be present on all the subdomains that need to be tracked together.

Step 2: Update Your Referral Exclusion List

In the Admin Panel, the root domain must be added to the Referral Exclusion List. This is probably already set up correctly, but it’s worth double-checking.

Referral Exclusion List

Let me explain why this matters. When the user moves from one domain to another (including subdomains of the same domain), the Universal Analytics code will send referrer information to Google Analytics. When Google Analytics sees a new referrer that is different from original source/medium information, it will start a new session with the new traffic source information. The Referral Exclusion List prevents this from happening and will let the original session continue.

Let’s See It in Action

Suppose we have a visitor flow that looks like the following:

  1. User arrives at:
  2. Clicks to learn more about widgets:
  3. Wants to know more about Widget 1:
  4. How much does it cost?
  5. Lets go back to all widgets:

Scenario One: Cookie Domain not set to auto, no referral exclusions – 2 Users, 3 Sessions

Scenario Two: Cookie Domain set to auto, no referral exclusions – 1 Users, 3 Sessions

Scenario Three: Cookie Domain set to auto, set as referral exclusions – 1 Users, 1 Session

Subdomain Google Analytics Example

Why You May Not Have Implemented Subdomain Tracking

Many references to subdomain tracking only mention the first step listed above, setting the cookie domain. These sources do not mention the Referral Exclusion List.

The Google Developer site for Google Analytics has very few references to subdomains. A search for “subdomains” points you to documentation for cross-domain tracking, and cookie domains. The former makes no mention of sessions or subdomains. The latter describes tracking users across subdomains, but makes no mention of connecting sessions across subdomains. It also highlights the following quote:

When using automatic cookie domain configuration, your users will be tracked across subdomains without any extra configuration.

While technically true (it only mentions “users,” not “sessions”), this statement is misleading because extra configuration is needed to track sessions across subdomains, which is a common goal. The subheading on self-referrals mentions the referral behavior of analytics.js, but requires a close reading to determine whether it applies to subdomains, or only root domains.

The Analytics Help site is similarly uninformative about subdomain tracking. A search for “subdomain” yields no information about the Referral Exclusion List until the fourth search result. Meanwhile, the first result on Common uses for cross-domain tracking highlights the following quote:

If you have updated your tracking code to analytics.js, then no additional configuration is required to track subdomains.

Only in the support page for the Referral Exclusion List does it explicitly state the configuration needed to track sessions across subdomains. No other easily-accessible official documentation states the need for this piece of configuration, or points towards the documentation that does.

Here is the official information labeled under “Cross-Subdomain Tracking.”

When your domain is in the exclusion list, then users can cross from one subdomain on your site to another without starting a new session. Without your domain in the exclusion list, when a user goes from one subdomain to another on your site, Analytics sees that as a referral from one hostname to another and starts a new session. As a result, your reports can have artificially inflated session counts.

Why You May Have Correctly Implemented Subdomain Tracking

By default, the Referral Exclusion List is pre-populated with the domain that you gave Google Analytics when you first created your property. This means that the majority of Google Analytics users will have their Referral Exclusion List configured properly for subdomain tracking, even if they didn’t realize the need.

There are four common reasons why something may be missing from your Referral Exclusion List:

  • You have multiple domains. Google Analytics only lets you enter one domain when creating a property, and only populates the Referral Exclusion List with that one domain. Any domains beyond the first being tracked in the same property must be added manually.
  • The original domain that you gave Google Analytics is not correct. This can happen if your website has moved to a new domain since your Google Analytics property was set up.
  • You migrated your property manually from Classic to Universal, and did not updated the Referral Exclusion List. Automatic migrations had their Referral Exclusion List updated automatically, but manual migrations did not.
  • You intentionally removed the entry from the Referral Exclusion List, because you want your data to include self-referrals. For example, if you want to view your subdomains both combined and split apart, you will probably have subdomain-specific views where you want to include cross-subdomain referrals.

What to Do Next

In most cases, the fix for this issue is simple: Check the Referral Exclusion List in your Google Analytics property, and makes sure that it includes all of the domains where you want to track cross-subdomain traffic as a single session. This will only affect data after the change is made; for better or worse, historical data cannot be updated.

If you have a particular scenario where you want to track the cross-subdomain traffic as a single session in one view, and as a referrer in another view, then there’s a special solution just for you. Because the Referral Exclusion List is a property setting, the view that combines subdomains will also receive the referrer information, breaking sessions. In this case, the root domain must be absent from the Referral Exclusion List, and the referrer information must be removed with a Filter on the combined view.

Logan Gordon is a Consultant with seven years of experience in Web Analytics, where he has helped many companies become more data-driven organized. He drove to Pittsburgh from California and is making up for not playing in the snow as a kid. His interests include Bulgarian language (due to his wife), cooking, Bulgarian cooking, and science fiction. His only pet is Bob, a dead shark in a jar.

  • Stephen M. Harris

    Thanks for this superb breakdown!

    I’d also recommend a third step: Use a GA Filter to prepend the hostname to the request uri, so different pages that have the same url path on different subdomains do not appear as the same page in GA. Optional, but generally a good idea when tracking multiple domains/subdomains to a single Property.
    Custom Advanced Filter config:
    Field A > Hostname > (.*)
    Field B > Request URI > (.*)
    Output > Request URI > $A1$B1

    • JohnnyWalker2K1

      Thank you for this!

  • urbanphotogeek

    I’ve set the referral exclusion list as well as cookieDomain=auto but it GA keeps showing source=(direct). Is there a step that I’m missing? Root domain and sub domains are using the same UA ID

    • I also find the same problem even after following many different tutorials on how to set cross-domain and sub-domain tracking. I can’t seem to keep the original source to track throughout the user flow. Also tested using custom URL parameters. Let me know when you’ve found a solution to the problem.

      • johnnytodero

        I am having this exact same issue of not being able to get the original source for conversion tracking. It is showing up as direct when the original visit to the subdomain was Adwords. Hoping someone has a solution to this.

    • Y2kchapin

      GA reports traffic from domains that are in referral exclusion list are shown as direct hence you see it.

  • The article comes at the perfect time (so thanks for the write-up) since I’m busy working on a GA-cleanup.

    My scenario:

    Domain 1:
    The user starts his/her session on and register/login on

    Domain 2:
    The user starts his/her session on and register/login on

    So, the user flow takes place across three areas:, and

    I’m thinking the fact that we are driving different users from source (.com and to the destination ( is not the best strategy.

    How would I go about setting up effective tracking for the above scenario?

    Cheers and thanks a lot once again

    • Logan Gordon

      Because and are on different root domains, you will need cross-domain tracking in addition to cross-subdomain tracking. We have another blog post about that here: .

      • Thanks for taking the time to reply to my question. I will try and apply it. Will also be using the real-time activity in GA as well as the Tag Assistant (by Google) recordings to track the cross-domain cookie share.

  • Ed Truman

    Good article with much needed clarification as the google help centre is misleading on this. Some further explanation on
    tracking the cross-subdomain traffic as a single session in one view, and as a referrer in another view (as mentioned above) would be helpful

    • Logan Gordon

      Unfortunately, it’s more complicated to have different session policies for two Views in the same Property. The Referral Exclusion List is a Property-level setting, so you can’t tell two Views to treat it differently.

      In order for any View to see the cross-subdomain traffic in the Acquisition report, the Referral Exclusion List for the Property must not contain the root domain. For any Views where you want to see a single session, you will need to use Filters to remove the Referrer information from each hit.

  • I also have a question: session gets broken between web and mobile subdomains despite having Cookie domain = auto and exclusion referral. I have two different GTM containers one for web and another for mobile. Is this the reason – different Tracker name? Do I need to set a tracker name for one of the GTM containers?

  • Mike

    Hi – probably stupid question, but in these examples, is each sub-domain being treated as a separate analytics property with its own tracking code?

    • Joshua Kinney

      No, he mentioned that you’d usually want to be tracking subdomains in the same property as the domain.

      • John

        What about if i have three domains pointing to the same main domain. points to, points to, points to

        Basically three domains but one hosting. Do I still need to use one tracking code ID or three different tracking code ID? Thank you.

        • Logan Gordon

          If you want to see pageviews from different pages as part of the same session, then you need to have the same tracking ID on all those pages. This is true regardless of whether those pages are on the same domain, different subdomains, different top-level domains, etc.

          I assume by “points to” you mean that is a vanity URL that redirects to a subdomain of As far as Google Analytics is concerned, is a traffic source and all content lives on subdomains of You should follow guidelines for tracking on subdomains.

  • thanks for sharing.

  • Tales Buonarotti

    For those whom be asking about which code should you use on main domain and it`s subdomains, here is another article for helping with this implementation:

    In terms of using the same code, it says: Use the Universal Analytics tracking code of the primary domain on all of the pages of the sub-domains.

    Hope I could help you.

    Thanks for the great article, Logan ๐Ÿ™‚

  • Terrence Jennings

    This is a very informative post! Very helpful for beginners like me!

    Metrixa-Data Driven Digital Marketing |

  • Shane

    Thank you for the article. What if you had a scenario where and were using two different UA ID’s, but was excluding from the Property level setting?

    Would it also be necessary to exclude to avoid self-referrals because of the separate UA ID’s?

  • Peter Fisher

    Hi Logan – many thanks for this article. I have a question about GTM and the gaCrossDomains ‘constant’ there – as per Helping out on a three subdomain website where analytics.js is part of the Data Layer via GTM, and where this constant was set incorrectly (only two subdomains declared, one of those wrongly as well). I have corrected this as per the Google guide. I have set up a different View for each subdomain and a fourth ‘global’ one without specifying a subdomain. Can you confirm that (a) this constant is actually required and the setup is sound, and (b) that with my current configuration the ‘global’ View will have the correct visitor / session totals, because each of the subdomain Views might count the same visitor twice (or three times) if they visited the other one (or two) subdomains as part of their visit?

  • Austin

    Do you recommend updating the request URI to include the hostname too since subdomains may have the same request URI?

    ex: hostname/requesturi as page dimension

  • Natalie Winslow

    Thanks for the post. I am a little confused about this part “The same implementation should be present on all the subdomains that need to be tracked together.” For the subdomain, what would go in the cookiedomain field? I have a site with 2 subdomains and we’ve had a tough time getting proper tracking. As an example, we have, and Thoughts?

    • Justin Atkinson

      Hey Natalie – I think I can help you with this one. Logan is just referring to making sure that the same GTM container script is embedded on each one of your sub-domains. The “cookieDomain” with the value of “auto” will not need to change. How Logan has it captured above is literally what should be in your “All pages” tag in GTM. From there, as Logan advised, you’ll want to make sure that the root domain is accounted for in the referral exclusion list, within the related GA property. You can validate that your implementation is working correctly by looking at the “Client ID” portion of the _ga cookie as you navigate from domain to domain. This will be the 3rd and 4th fields in the _ga cookie. You will want them to be the same as you navigate from domain to domain – if they are different, you know you need to work back through your setup to see where you may have gone wrong…here is a link to a break down of the _ga cookie in case it helps.

      I hope this helps.


  • Yusuf Erdem Demirli

    Hello Logan,
    This is great post to understand simply. Thank you very much. I am confused with one case which is shown inScenario One. As I know, from domain to subdomain client id is shared but in scenario one, user chances. Why does it occur?

    Thanks again,


    • Logan Gordon

      Client ID is only shared from domain to subdomain if the Client ID is stored at the correct domain level (which the “auto” setting does). If this setting is misconfigured, then will store its Client ID cookie on the subdomain instead of the root If it is stored in the subdomain, then cannot read it.

      • Yusuf Erdem Demirli

        Thanks for reply, Logan. All is clear now.

  • Gyanendraa Mishra

    Thanks Logan Gordon !! Its Really very helpful for me .

  • Any ideas why my events via my GTM setup work on the main domain, but not on the subdomain? Tracking works, I can see the page visit load in real time in analytics, but can’t get any of my scrolling events to fire ๐Ÿ™

  • Daphne Tideman

    Hi Logan,

    I have a client who tracks the data of their subdomain under a separate Property. They don’t mind the subdomain showing up under referral as it gives them an idea of where the traffic has come from.

    Would you still recommend using Cookie domains and Referral Exclusion?

  • Elizabeth Lord

    Hi Logan –
    I refer to your article often, thank you for such helpful information. Is there any method reduce session count bloat in property A when a user travels back and forth between subdomains, and one of the subdomains does not share the same GA tag as property A?

    • Logan Gordon

      If the subdomain doesn’t share the same GA tag, that limits what you can do. You won’t have a single GA property that can see all the pageviews from main domain to subdomain and back, that can stitch those pageviews together into a single session. Still, there are some things you can do.

      If I’m understanding you right, the situation you’re in is that Property A records some pageviews, and then there’s a gap where Property A doesn’t see some pageviews (because Property A doesn’t have access to the subdomain’s pageviews), and then Property A records a few more pageviews again. And you want the first batch of pageviews and the last batch of pageviews to be part of the same session, despite the gap.

      The most important step is making sure your Referral Exclusion List is up to date. If Property A sees a hit that came from a different domain (even if it’s from a subdomain), it will always start a new session *unless* the referrer is in the referral exclusion list. So make sure that the Referral Exclusion List for Property A contains the main domain you’re tracking.

      You may also consider changing the Session Timeout setting for Property A. This is under other Tracking Info -> Session Settings in the Admin menus for your Property. By default the two batches of pageviews will count as different sessions if the gap between them is 30 minutes. If you think people commonly spend longer than that on the Subdomain, then increase this setting.

  • Immigration Downunder

    Hi Logan – this is awesome. I have a question though:

    I have a client site where there are two subdomains. These are set up in GA as two separate properties with different IDs. When a user goes from one to the other, they appear as direct traffic. The domain has been in the referral exclusion list for some time which i guess is why the above appears as direct and not a referral. But the original attribution is still lost.
    I’ve set cookieDomain=auto in GTM for both UA tracking tags.

    I canโ€™t use cross domain tracking with separate UA IDs and had thought that the referral exclusion list should still work in this context. Is that not the case, and if not, is there anything that can be done short of creating a new roll-up property in GA to track subdomains together?

    Thanks very much

  • Dana R.

    Hi, Logan! Thanks for the article, very useful. I have an extra problem: the site has a lot of subdomains I don’t want to track and one that I want to see as referral. is added to the referral exclusion list, but this blocks the one I want to see: Is there a regular expression I could use to add this exception? The blog has another UA.

    Actually, the big idea is that my client wants to see the visits from blog to site. I thought that since there are few visits from blog, it will not mess the data too much if sessions are counted as new. Do you know another simple way to do this?


    • Logan Gordon

      Hi Dana,

      This is a fairly complex use case, and I think you will have to use other tools than just the Referral Exclusion List in order to make this work. Unfortunately, the exclusion list is just a straight text-match, with no support for regular expressions. So if you want to exclude, then will always be excluded.

      There are a few approaches I would explore. The simplest option is to add UTM parameters to the links from the blog to the main site. Using UTM parameters on internal links is not something that I normally recommend, but in your case it sounds like what you’re looking for.

      Another option is to use Advanced Filters instead of the Referral Exclusion List. This will allow you to use a Regular Expression instead of straight text-matching in order to identify which Referrers you want to remove. This is a little tricky to implement, so I strongly recommend using a Test View where you can experiment with Filter settings before applying to your main reporting view.

      A third option is to store the webpage referrer in a custom dimension on every page view. Referrer is a built-in variable in GTM, or use document.referrer if you have on-page code. This will allow you to identify which pages on have as a referrer. Note that, compared to the other methods, this does not cause a new session to start if someone comes from the main site, to your blogs, and then back to the main site.

  • Marie

    Hi Logan,

    So I have my tag configured properly with cookie domains set, and I have my site,, in the referral exclusion list. However, I’m still getting referrals from, mostly to the homepage of What the heck can that mean?

    • Logan Gordon

      There are a few things that could be causing this. It’s hard to tell without looking at your specific site and your data.

      One thing to be aware of is campaign timeout. Traffic source information “sticks” to a user for 6 months. If you had the cookies set incorrectly at one point, and then fixed it, users who had “” as their referrer before the fix who visits your site directly will show up as having come from “” for the next 6 months. You can validate this hypothesis by looking at the New Visitors segment vs the Returning Visitors segment: the issue should only be present for Returning Visitors.

      The issue could also be caused by something else entirely, that’s just a shot in the dark.

      • Marie

        Seems to be a pretty good shot in the dark–you’re right; no new users, and the amount of referral traffic has been slowly declining since I made the fix. Thanks for the help!

  • Great article Logan. Thanks for this. Is there any way you can exclude all subdomains so that they will all be looked at as the same site but not all of them?

    I’ve got a client who wants to track and see things like and as being part of the same site. However, they want to treat and as separate sites that refer traffic to the others viewed as one site.

    Meanwhile, the root domains and all subdomains have the same GA js snippet.

    • Logan Gordon

      There are ways to do this, but it’s not as straightforward as the more common cases I outlined in the main post. The Referral Exclusion List works by string-matching, so if is on the list, then all subdomains will be excluded. You don’t get the ability to pick-and-choose.

      In order to get the reports that you want, I think you’ll have to use Advanced Filters to selectively remove certain specific referrers from your data.

      • Arun kumar

        Hi patrick Healy,

        Even Iโ€™m facing the same issue did you find any solution for this?

        Logan can you please share some more information on how to use advanced filters?

  • Slava M.

    Thanks Logan!

    But what if I have subdomains, lets say,, and the main site My goal is to work with all traffic from site1,site2,site3 on except of and
    Each website has personal GTM container and tracking object.
    How can I set subdomain tracking via GTM and exclude from tracking? Please assist!

    • I’m in a similar boat except that they want to track site1, site2, and as one big site but keep site 3 a referral site – all using the same GA account.

      There’s nothing wrong with having their own GA accounts per se but if you want to treat a bunch of websites all as one having them all on the same GA account makes sense.

  • Ankit

    Thanks! Helpful post.

  • jabier

    what about HTTPs, how you deal with this scenario:

    google result -> ->

    thanks in advance

    • Arijit Biswas

      Yes. Exactly I’m in the same problems. ๐Ÿ™

      • Itsik Ben Ezra

        Same problem, how to fix?

        • Arijit Biswas

          Well, the author does not seem to reply our questions or problems.

      • Logan Gordon

        The protocol (HTTP vs HTTPS) shouldn’t make a difference. Cookies are stored at the domain level, and accessible regardless of the protocol. The referral exclusion list also doesn’t distinguish based on protocol. Are you seeing broken sessions in the data when the protocol changes?

        • Arijit Biswas

          Well I haven’t implemented it yet, as far I knew, GA treats http & https as different.
          Should i implement ?

        • Geoff B

          Hi Logan, Thanks for the great article. I have everything set up as you explained, but we are still seeing self referrals from our sub domains that were set up on HubSpot. Our main site (www.) is secured with SSL (https), but our subdomains are not… Any ideas on how to block the self referrals from sub domains…?

  • TaniaSteenkamp

    Hi Logan,
    My client has changed their domain from to without notifying us….the subdomain is still called…would this affect subdomain tracking?

    • Logan Gordon

      It sounds like some of your content is now on, and some is now on There are separate domains, so you will need to use cross-domain tracking, not just subdomain tracking. The fact that the blog is on a subdomain of is a minor issue compared to the change of primary domain. See Dan’s blog post on cross-domain tracking: .

  • Keesjan Deelstra

    wow, great community overhere!
    Logan Gordon, do you also have problems with the Page Analytics Extension in chrome not reporting clicks from to

    • Logan Gordon

      I don’t use that extension, sorry I can’t help.

  • Arijit Biswas

    My root domain is https but my subdomains http how should I track then?

  • David Wang

    Does this also apply to logged in pages?

  • Soul Shaolin

    Hello. In in a situation where I have” Cookie Domain set to auto, set as referral exclusions”, however my subdomain is opened in an Iframe. My client ID is consistent. But when moving from my main domain to my subdomain the referrer is set to “” (my main domain). How can I keep my referrer consistent ?

  • Kumar Vansh

    Hello, That was the great one but Iam having the query somewhat different.

    Query – We are getting the traffic on the daily basis like in between 400-500, but Google Analytics doesn’t track the traffic because The traffic is loaded under Iframe? So, May I request you to help me to know What the process should I do so that Google Analytics track the traffic loaded under Iframe?

  • Elizabeth Smallsโ„ข

    Hi Logan! Great article, thanks for laying it out so clearly so I could sanity check myself. You may also consider adding a 3rd, optional step to include the subdomain into the pagename (using Advanced Filters) so that when a user goes to and the “/” pages are uniquely separated in reporting.

    • Zachary Summers

      The domain is sent as “hostname” with every event and view by default, it’s not too difficult to add a secondary dimension of hostname when reporting.

    • Email Experts

      Hey Elizabeth, are you able to elaborate on this slightly for me? I only need to “/” pages unique, the rest of the site tracking is good.

    • JohnnyWalker2K1

      Would love to learn a little more about this!

  • Sam Ferguson

    Thanks! Solved a problem I couldnt figure out. That pesky referral exclusion list!

  • Angie Ibrahim

    Hi There

    This might be a stupid question but if I have a domain for example, and that is tracking, and now I have a new sub domain which I need to track and this has another site on it, do I create this as a new property within the current analytics account ? And then from there setup the referral exclusion on both domains ? Does this make sense Thank you.


  • Thoman

    Hello, my website has used some subdomain for lang but Can I add all of subdomain to GWT ? my website is , Thank in advanced

  • Its a quite interesting article. Explained in real simple terms

  • Ramon Van de Ven

    Great article, thanks!

  • Gabe

    Thanks Logan this is super helpful!! Question where does the ‘Auto Links Domain’ under ‘Cross Domain tracking’ in GTM fit into this?

  • matteo

    hi there! great post! just one question, what about this rare case:
    – i own domain A
    – a domain of a friend B is not controlled by me, nor I want to implement any special tracking
    – domain B has a sub-domain B-2, which is controlle by me and for which I want to implement the appropriate tracking
    how can I set the B-2 tracking properly without compromizing the standard way of tracking traffic from site B?

  • TaniaSteenkamp

    Hi Logan!
    Do I go to every analytics tag and remove {{Your_GA_TRACKING_ID}} from the tracking id field and complete the Google Analytics Settings field {{Settings Template}} instead?

    or do I just update Google Analytics Settings field to {{Settings Template}} in addition to my tracking id field in every tag?


  • Ramin Tasouji

    How can I track number of sessions of blog coming from home-page or vice-versa?

  • Thank you very much!

  • Simon

    Hi Logan, great help, managed to get our subdomain tracking, however it is not clear in Behavior Overview which page is which. For instance the landing page of the subdomain ends ‘/’ or ‘/index’, as does the homepage of the whole site. I can switch to Page Title to check but is there a way of differentiating in the page view?

    • Logan Gordon

      You can add the Hostname as a secondary dimension. You may also consider adding an Advanced Filter to your view to prepend Hostname to Page in this situation as well.

  • Jaztek

    Hi – I was wondering if this is necessary if we are using subdomains for multilingual purposes.
    We use shopify and are obliged to setup the following structure.

    Do you recommend using the method you explained for this or is only if we want to track users ACROSS all three sites?

    In my case is it best to use separate tracking scripts for each site as we don’t want them sharing the same analytics?


    • Logan Gordon

      This solution is only for when you want to track users across all three sites. In the case of language-specific subdomains, there is probably very little overlap in the user base. You may still be interested in seeing how many people land on one domain and then navigate to another, but you can obtain that from click events.

  • Kurt Bugeja

    I have a subdomain and I want to drive traffic from there to the main website and then this goes to and I want the conversions to be attributed to – do I need to go through all this process of setting them or is it done automatically by GA when installing the tags? I am a bit confused to be honest.

  • Mo Parikh

    What if a customer starts on the subdomain, then goes to the main root domain, then back to the subdomain? Do I need to add the subdomain to the referral exclusion list as well?

    • Mo Parikh

      I think I found the answer…adding the root domain will automatically add the subdomain too ๐Ÿ™‚

  • Alex Wellick

    Thank you for the great post, but there is something that aren’t clear for me.
    For example, we have several amount of subdomains (e.g.,,, and we have a single property and a view for each subdomain (1 property, 4 views).
    The problem is that Referral Exclusion List is placed at property level. If we add all our subdomains in the list, we won’t see them in Referral reports from now on. But if we want to track user journey through the subdomains, how can we do this if we won’t see that information in Acquisition > Referrals report.

    Thank you!

  • Yasir Shamim

    How do i make syntax of sub-domain of the sub domain like

  • Hi Logan, great article. We had a root domain which is for promoting our invoicing, crm, and project management platform and a sub-domain for #taimer user on-boarding. With your help, we could install and configure Google Analytics. Hope similar article was existed for Facebook Pixel.

  • Nico

    I have none of that ! My cookie domain is set as auto and my domain is set in the exclusion list but all I get when users go from one subdomain to another is direct trafic. Any idea why ?

  • Riccardo Pradella

    Guys you are amazing. The level of the information provided is !!!!

  • Jamie

    Hi Logan, great article and I get great help from it. Thanks for your time. I have a question for you, though: You listed 3 scenarios in the post to explain how the two settings affect user and session counting. But how about the 4th: cookiedomain not set to auto, set as referral exclusions, which is exactly my case. We added our domain as referral exclusions long ago but neglected the cookiedomain setting in GTM. Is this scenario the same as “cookie domain not set to auto, no referral exclusions”?

    I am asking it because we have been receiving self-referral traffic on our website, which confuses me a lot.

    Looking forward to your reply. Thanks again.

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