Understanding Google Universal Analytics and Classic Analytics, Subdomain Tracking

Google Universal Analytics

Google Universal Analytics

I recently acquired a new client. They were needing the usual website optimization and digital strategy. As usual I wondered about their data. Luckily they recently installed Google Analytics so I was really happy. Once I researched the client’s analytics I noticed they had a bunch of sub domains they forgot to tell me about. At this point I noticed they were using the new and improved “Google Universal Analytics.” A new and improved tracking code launched in March 2013. (Learn more about the benefits of Google Universal Tracking.)

I had a lot of questions regarding the code, especially now that I have subdomains to track. My immediate question was: “Is Google Universal Tracking Code customization basically the same as the old code?” Well, let me go into some of the things I found out.
Note: Some of this tutorial might be real simple for people, but I feel it’s important.

How to identify Google Universal vs Classic Analytics

Ok, first let’s identify what code the client is currently using.

Google Universal Code Identification

Google Universal Code Identification


Google Classic Code Identification

Google Classic Analytics Identified


That is pretty simple right? Want more information? Go to Google Help for more about the NEW Google Universal Analytics.

Subdomain Tracking with Google Universal Analytics Code

Now let’s review subdomain tracking. There are several tutorials on the web that explain subdomain tracking. Many of the tutorials are outdated and have “extra” filtering associated. I had to do some, trial and error to get my subdomain tracking perfect. The way I describe below worked for me with Google Universal Analytics.

[box color=”red” icon=”config” size=”big”]

WARNING: Raven Tool GACONFIG Out of Date

You might come across a Raven Tool called GaConFig (gaconfig.com – http://gaconfig.com/one-domain-with-subdomains/). I use Raven Tools for SEO purposes to track my clients. Unfortunately this tool is out of date. Do not use it for Google Universal Tracking Tool. When Raven Tools updates their Google Tracking Tool I will update my article. (PS: If anyone notices Raven’s Tool updated let me know)

This is Raven Tools OUT OF DATE TOOL Screenshot:

Raven Tool ConFiG Universal Analytics


Ok so let’s get to the “tutorial” part of my little article.

The first thing you need to understand is that the Google Tracking Code needs to be the same for the main domain as the subdomain. So to reiterate what I just said; the SAME Google Tracking Code will go on “www.maindomain.com” as “subdomain.maindomain.com.”

[box color=”green” icon=”settings” size=”big”]

Where to find Google tracking Code

You find the code by clicking on > Admin > Tracking Info > Tracking Code.
Once you find the code snippet, copy and paste it into your web page, just before the closing </head> tag*. If your website uses templates to generate pages, enter it just before the closing </head> tag in the file that contains the<head> section. (Most websites re-use one file for common content, so it’s likely that you won’t have to place the code snippet on every single page of your website.)

Here is a little more information regarding inserting your code on your website straight from Google Analytics Help:


Creating Profile Views for Subdomain Tracking

So let’s create a different “profile view” for each subdomain. I feel this is where many newbies get a bit of a headache. We will be creating three views in this exercise.

A. WWW View (traffic ONLY for the MAIN Domain).
B. Subdomain View (ONLY traffic for the subdomain)
C. Total Traffic (Combining Subdomain and WWW traffic into one Total View)

STEP 1: Subdomain Profile View.
Let’ make our first view:

Google Analytics profile views

    1. Click on “Admin”
    2. Click on “VIEW (Profile)”
    3. Click on “Create New View”
    4. Choose “Reporting View Name” The name can be “Shop View.”
            • So for example if your website is shop.domain.com, name the view “Shop View.”
            • For subdomain’s use your www.domain.com as the URL when creating the ‘Profile View.’



STEP 2: WWW Main Domain View. (do the same thing as above)
Let’ make our second view:

    1. Click on “Admin”
    2. Click on “VIEW (Profile)”
    3. Click on “Create New View”
    4. Choose “Reporting View Name”
      1. The name should be easy for you to correlate with ONLY the domain. So for example, name the view “WWW View.”

STEP 3: Let’s rename our MAIN View which is probably named “yourdomain.com.
Go to: Admin > View (Profile) > View Settings

  • You will see your Profile View Name as yourdomain.com
  • You can change that to something like “Total View,” or whatever makes it easy for you to know that this view is ALL traffic including subdomains.

Now in essence there should be three views. When you select “View Profile” you will see three different views that you can now select.

  1. Total View
  2. Shop View
  3. WWW View

*Remember, you have Google Universal Code inserted on all subdomains associated with the the main domain including the main domain. So now we need to “split” the traffic to the right “Profile Views.”

Google Universal Code Filtering

STEP 1: Filter your subdomain “Shop View.”
Go back to > Admin > View (Profile): select: “Shop View” > Filters
click ( +New Filter )

Google Subdomain Filtering1. Filter Name: Include Shop Subdomain Traffic
2. Filter Type: Predefined
• — include only –traffic to hostname — that contain
3. Hostname: shop.yourdomain.com

( save it )



STEP 2: Filter your domain “WWW View” (only traffic to WWW) 

Go back to > Admin > View (Profile): select: “WWW View” > Filters
Select +New Filter

1. Filter Name: www Domain Only
2. Filter Type: Predefined
• — include only –traffic to hostname — that contain
3. Hostname: www.yourdomain.com

( save it )

STEP 3: Filter all traffic to the Total View (prepend show all domains)

*This will show full domain in your reports, so you know what traffic comes from sub domains etc.

Filter all domain and subdomainGo back to > Admin > View (Profile): select: “Total View” > Filters
Select +New Filter

  1. Filter Name: All Domain Data
  2. Filter Type: Custom Filter
    • — Advanced
  3. Field A -> Extract A: Hostname (.*)
  4. Field B -> Extract B: Request URI (.*)
  5. Output To -> Constructor: Request URI /$A1$B1
  6. Field A: YES
  7. Field B: NO
  8. Override Output: Yes
  9. Case Sensitive: No

( save it )

So there you go, that’s pretty much it. I hope I was able to help someone out there needing more clarification regarding the google code changes with subdomain tracking.

If I did help you out please follow me on Twitter, Pinterest, GooglePlus and/or drop me a note.