Find out how Path Interactive can deliver a customized approach to growing your business.
Please tell us about yourself and we'll contact you shortly.

How to Track Subdomains in Google Analytics

Jennifer Gayadin October 17, 2012 Category Digital Marketing

Google Analytics and Subdomain Tracking

Managing your master domain and your subdomain can be extremely helpful, especially if you have a blog and are focusing SEO efforts on multiple site channels.  Moreover, It is necessary to make appropriate modifications in order to share visitor data across both of your domains.

Google Analytics Subdomain Tracking Steps – Quick Steps

  1. Create another profile & use the same code.
  2. Add a Custom filter in the advanced settings.
  3. In Field A, type “Hostname” (word for word)- set value to  (.*),
  4. In Field B, type “Request URI” (word for word) – set value to (.*),
  5. Set Output Output To –> Constructor & Provide value to be “$A1$B1”

Step 1 – Create a Google Analytics Profile

Google first recommends that you create a master profile for your primary domain. If you set a default profile, modifications still need to be made. The profile should have no filters added. This is extremely important, because you can always have historical data for the site you’re creating the filter for.

Step 2 – Create another profile and reuse your tracking code

Creating  a new profile for the filter acts as a nice cushion in case there are errors you might encounter.

Before you install the code your Google Analytics Code, make sure you’re within the settings. Select the option in admin>tracking code>one domain with multiple subdomains and simply copy and paste that code into the <head> section of your site. This code should be present on all pages you wish to track.

Helpful Note – If you have a blog in WordPress, they have an useful plugin called, “Google Integration Toolkit”. Drop the analytics into the blog plug-in and viola! Data on every single page.

*IMPORTANT* The Google Analytics code should be present on ALL pages you wish to track

Step 3 – Modify your cross-domain profile with a filter to show the full domain in your content reports

Once you have domain linking established, you will only see the request URI in the content reports,not the top-level or sub-domain for a given page. So for example, visits to the following pages:
— http://www.example.com/index.php and another page on
— http://sub.example.com/more.php
The reports will show:
— index.php
— more.php
You will not be able to differentiate which page is from which domain. To show the domain in the page reports, a filter is necessary to include all components of the page URL, as follows:

    1. In the Profile Settings page, click the Add Filter link.
    2. Choose Add New Filter and provide the filter a name.
    3. Choose Custom Filter and select Advanced on the Filter type settings.
    4. Under Advanced settings:
      1. FieldA should be set to Hostname
      2. FieldB should be set to Request URI
    5. Set the values for both Field A and Field B to (.*), which is an expression that captures all characters.
    6. Set the Output To –> Constructor option to Request URI and provide $A1$B1 as the value for that choice.

Google Analytics is currently designed to track visitor and content data from a single domain.That being said, if you manage at least one (or even multiple) subdomains, that this modification to the tracking code occurs.

Look forward to you losing all the unorganized data and put your insights back into shape!

Most Recent

How to Build a Data-Driven Business Case for Content

By Paul VanHevel, PathInteractive | September 16, 2016

A Step-by-Step Guide to Quantifying the Value of Content In the sometimes-gray world of organic search marketing, conveying the value of your […]

Read More

The Science Behind Data-Driven Attribution, Google’s New Attribution Model

By Steven Sonnes, PathInteractive | August 5, 2016

When shopping online customers often touch multiple marketing channels before they convert. In marketing this is known as the consumer […]

Read More

The New Mad Men: Looking Back at Advertising’s Evolution Towards Digital Marketing

By Ann Paskor, PathInteractive | July 19, 2016

Everyone in the marketing world has heard of Mad Men. They were the cool guys in the 60’s who worked […]

Read More