Toll Free: 1-877-695-7388

GTA: (647) 699-2838

Search Engine People
  • SEO
  • SEM
  • CRO
  • Display
  • Blog
  • Why Us
  • Contact
  • Join Our Team
  • Get A Quote

Toll Free: 1-877-695-7388

GTA: (647) 699-2838

How To Setup Subdomain Tracking

Martin Brown | September 22nd, 2016
Tweet68
Share33
Share
Pin
101 Shares

ga-subdomain-tracking

Google Analytics is configured to record visitor traffic only for a single domain. This is the default setup.

This means that when a visitor reaches a website -- example.com -- for the first time, Google Analytics records it as a new session from a new user.

But if that visitor travels travels to and from the site's subdomains -- blog.example.com, support.example.com -- Google starts a new session for the same user, and it lists the other part of the domain as the referral site.

This causes problems when you want to track the number of visitors and the number of sessions for your whole site, subdomains included.

Fortunately, site owners can change this behavior by following a set of simple steps.

Classic Google Analytics

With Classic Google Analytics there is a need to alter the tracking script to enable subdomain tracking.

Consider a site, example.com, with 2 subdomains; blog.example and support.example.com

The site owner would make this simple change to the tracking code:

  • Asynchronous Syntax
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345-1']);
_gaq.push(['_setDomainName', 'example.com']);
_gaq.push(['_trackPageview']);
></script>
  • Traditional Syntax
<script>
var pageTracker = _gat._getTracker('UA-12345-1');
pageTracker._setDomainName('example.com');
pageTracker._trackPageview();

Google Tag Manager

If your analytics is implemented via Google Tag Manager, go back into that tag and set 'cookieDomain' to auto.

Universal Analytics

The tracking code from Universal Analytics is already completely set to track subdomains. BUT -- you absolutely need to verify, and perhaps update, the Referral Exclusion List or Google Analytics will start a new sessions when switching between the subdomains.

The “Referral Exclusion List” can be accessed through the following path:

Admin -> Property -> Tracking Info -> Referral Exclusion List

Once there ensure the main, top-level domain is listed there: example.com in our case.

If it's not there, click Add Referral Exclusion and add the domain.

image

Optional: Filters

See Domain Name In Report

Google Analytics displays URLs without the domain name in its tracking list. This can make it hard to easily see if /page1.html was accessed on example.com, blog.example.com, or support.example.com

This can be fixed by adding a filter to the view:

  • Filters -> Add New Filter -> Custom ->Advanced
  • Choose ‘Hostname’ for Field A and enter (.*) in the field space
  • Now select ‘Request URL’ for Field B and again enter (.*)

In the third step, choose ‘Request for URL’ for Field C and enter the value $A1B1

SNAGHTML1081f815

Reporting On (Sub)domains Separately

If you want to be able to see reports for each domain and subdomain separately, you have to create views for each and one for all combined.

In our case of example.com, blog.example.com, and support.example.com we would have 4 views:

  1. All Traffic Combined
  2. example.com
  3. blog.example.com
  4. support.example.com

For each domain specific view you have to create inclusion filters that remove all traffic from the other domains.

Go to Filters -> Add New Filter -> Custom -> Include -> Hostname

For the main domain, example.com, we would enter:

image

When the blog.example.com view is selected we would enter:

image

Hand-Picked Related Articles:

  • Which Pages Receive The Most Internal Traffic [Google Analytics]
  • Dimensions & Metrics: Which Is What In Analytics
  • How To Use Browser Language & Analytics To Find New Markets

* Adapted lead image: Public Domain Dedication (CC0) Public Domain, pixabay.com via getstencil.com

Tweet68
Share33
Share
Pin
101 Shares
Posted in Analytics & ROI Analysis

About the Author: Martin Brown

Martin Brown is the Marketing Executive of Top SEO Rankers based in New York. Top SEO Rankers evaluates and lists the top Digital Marketing firms and also gives SEO service providers a direct channel for prospective leads to find them.

Top SEO Rankers

Recent Posts

  • The Manifest Names Search Engine People Among Toronto’s Most Reviewed SEO Companies
  • Movin’ On Up! Why Migrating to Google Analytics 4 (GA4) Should be a Priority
  • A Year in Review: The Digital Marketing Trends That Defined 2021
  • The Basics of Video Marketing
  • Just How Much Do Google Reviews Impact Your SEO Ranking?

Categories

  • Analytics & ROI Analysis
  • Company News
  • Content
  • Conversion Optimization
  • Display Advertising/RTB
  • Email Marketing
  • En Español
  • En Français
  • Inbound Marketing
  • Lead Nurture & Marketing Automation
  • Local Search
  • Marketing
  • Mobile
  • Partnership Marketing
  • PPC
  • PR
  • SEO
  • Social Media Marketing
  • Web Design

Additional Posts

3 Ways To Kill It With Extended Text Ads (ETAs)

September 21st, 2016 | by Robert Brady

How To Use Social Media To Source Articles & Engage Readers

September 19th, 2016 | by Brett Relander

Understanding The Customer Acquisition Lifecycle

September 16th, 2016 | by Omair Siddiqi

LET'S TALK

Need more information or want to get in touch?

Get in touch!
  • SEO
  • SEM
  • Display
  • Blog
  • Why Us
  • Join Our Team
  • Contact Us
  • Local SEO
  • Small Business SEO
  • Enterprise SEO
  • International SEO

LOCATION

1305 Pickering Parkway,
5th Floor Pickering, L1V 3P2

PHONE

Toll Free: 1-877-695-7388
Greater Toronto Area: (647) 699-2838

Social

© Search Engine People Inc. 2023 – Canada’s Top Digital Agency
© SEP 2023 – A Search Engine People Company | Privacy Policy

Search Engine People