Home > Sites > Properly track subdomains in Google Tag Manager

Properly track subdomains in Google Tag Manager

BetterNow platform is hosted in a masked subdomain. That means that even if we host the platform, Google Analytics will reflect the masked domain. Eg. if BetterNow hosts your platform in charity.yourbetternow.org and your domain masking is fundraising.yourcharity.org, the user will see fundraising.yourcharity.org in their browser and your Google Analytics will register a hit in the same subdomain.

If you're not tracking subdomains already, there are a few changes that need to be done in order to properly track the traffic from the platform.

Enable subdomain tracking in Google Tag Manager

1. Set full URL filter (Optional)

Set up a filter to see the full URL in your Google Analytics report.

This way you’ll be able to see in the full URL instead of the URI request, giving you a full overview of the users’ journeys, and enabling you to create different reports to track performance step by step. 

Full URL of the page: fundraising.yourcharity.org/create-fundraiser/choose-project
Request URI: /create-fundraiser/choose-project
Output in Google Analytics: fundraising.yourcharity.org/create-fundraiser/choose-project

Create an Advanced Filter Filter
Type: Custom filter > Advanced
Field A: Hostname Extract A: (.*)
Field B: Request URI Extract B: (.*)
Output To: Request URI Constructor: $A1$B1

2. Set Cookie Domain in Google Tag Manager to track subdomains

The cookie domain is set to auto by default if you are using a Google Analytics Settings variable.

We recommend using the Google Analytics Settings variable. If you are not using it you can set cookieDomain to auto by adding a field under Fields to Set in your Google Analytics tag.

3. Add your domain to the Exclusion Referral List

To avoid polluting your referral report with traffic from your own subdomain, add your own domain to the referral exclusion list. This exclusion will affect the domain and all subdomains. 

Admin > Select a Property > Tracking Info > Referral Exclusion List: charity.com