How To Setup Tracking And Maintain Attribution When Using A Landing Page on a Subdomain

Learn how to keep your attribution and session intact - even on non-Shopify landing pages! ###

Cross Domain vs Subdomain Tracking

Let's distinguish between cross-domain and subdomain tracking.

  • Cross Domain Tracking - This deals with measurement between different domains. E.g. You have a store on mystore.com or a blog on myblog.com and you want to view them as if they are one property in Google Analytics. In this scenario, you need cross-domaincross-domain tracking.
  • Subdomain Tracking - This is needed if you have a website with pages on a subdomain (e.g. mystore.com and landingpage.mystore.com).

This article will walk through subdomain tracking, not cross domain tracking.

Subdomain Tracking Challenges

There are two primary concerns when tracking on a subdomain

  1. Keeping the Session Intact - What we don't want to happen is for a session to get fractured when the shopper moves from the subdomain to the main domain. A fractured session means you'll get multiple sessions in Google Analytics when you should only have one.
  2. Keeping the Attribution Intact - Additionally, we'll want to make sure that the associated marketing channel or website that drove your shopper to your website is given recognition for the actions the shopper then takes on your website (e.g. a purchase). We don't want the attribution details to be lost when the shopper moves from the subdomain to the main domain.

The good news is: you can solve both these challenges by walking through the below steps.

How to Setup Subdomain Tracking:

The good news is: you can solve both the above challenges by walking through the below steps.

1. Set the Cookie Domain to Auto in your Google Analytics Settings Variable.

In your Google Tag Manager Account, find your Google Analytics Setting Variable.

In this variable, make sure that the Cookie Domain is set to auto.

πŸ“˜

What does this do? By doing this we set the ga cookie at the highest level available on the domain (making it available to both the subdomain and the main domain). This helps GA to understand the events as a single session.

2. Add your Subdomain as a Referral Exclusion in Google Analytics

In Google Analytics, navigate to your Referral Exclusion List Settings.

Add your subdomain as a referral exclusion.

πŸ“˜

What does this do? This prevents your subdomain showing up as a referral source in your GA reports.

3. Import the Pre-Built Subdomain Linker Tag

Navigate to the Subdomain Link Decorator Pre-Built Tag in your Elevar App.

Download the Pre-Built Tags.

Import the Pre-Built Tags into Google Tag Manager

4 .Customize the Subdomain Linker Tag (Domain & additional UTM parameters)

In the tag titled Update After Import Subdomain Link Decorator, update line 4 with your main domain URL

🚧

Warning: Please include the ending ".com", ".ca", etc. Please do not include the beginning https/http or a trailing slash.

In the trigger titled Update After Import All Subdomain Pages, update the first Page URL rule with your own subdomain & main domain.

πŸ“˜

What if I have multiple subdomains?

If this is the case, use the following format: SUBDOMAIN.DOMAIN|SUBDOMAIN.DOMAIN

Correctly Formatted Examples:

try.getelevar
try.getelevar|learn.getelevar
try.getelevar|learn.getelevar|blog.getelevar

5. Publish

When ready, press Submit > Publish in Google Tag Manager to make these changes go live.

How Do I Know If It's Working?

There's two items you'll want to QA to know if your subdomain tracking is working:

1. Is your Google Analytics' session stays intact?

Use Chrome's Developer Network Tab to see if the CID property in your Google Analytics hits remains consistent as you navigate from your subdomain to your main domain.

  • On your Subdomain, look at the Google Analytics hit in your Chrome Developer Network Tab for the CID property. Note the value.
  • Click a link that leads to your main domain.
  • On your main domain, look at the Google Analytics hit in your Chrome Developer Network Tab for the CID property. Note the value.
  • If the value is the same on your subdomain & main domain, then your session stayed intact!

2. Are your UTMs and click ids are being passed to your main Shopify site?

  • Add test URL parameters to your subdomain URL
    • Example: try.getelevar.com/?utm_source=testsource&utm_medium=testmedium
  • Click a link that leads to your main domain
  • Check to see if the URL parameters are now present in the URL of your main domain
    • It should look similar to: getelevar.com/collections/products?utm_medium=testmedium&utm_source=testsource
  • If you are seeing the parameters appearing in your main domain URLs, it's working!