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

[/box]

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:

[/box]

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.

21 thoughts on “Understanding Google Universal Analytics and Classic Analytics, Subdomain Tracking

    • Ravey says:

      Sorry for the late reply, but it is Thanksgiving in the USA and I have been away. Keep in mind the subdomains are under the MAIN Domain. You should add the SAME GA CODE to all subdomain and DOMAINS you want to track. So the URL will be the main domain http://www.domain.com and in the second part of the tutorial you will ‘filter’ out shop.domain.com into that specific “profile view.” Does that make sense? I hope it helps you, if not let me know. Regards,

    • Ravey says:

      Sorry for the late reply, but it is Thanksgiving in the USA and I have been away. Since you added the GA Code to ALL subdomains and Domains the URL will be http://www.domain.com when configuring your ‘Profile view.’ The second part of my tutorial dealing with subdomain filtering you will ‘segment’ the data of shop.domain.com into that specific ‘profile view.’ Does that make sense? Let me know if it doesn’t. Regards,

  1. Jakob Boyer-Dræby says:

    The part about subdomains a little thin, however. I’m experiencing issues with implementing standard GA Universal A… snippet, not tracking domains or subdomains, unless I adjust the domain-part in the snippet.

    • Ravey says:

      Are you implementing GA onto a website that currently doesn’t have GA? Keep in mind, there is NO migration as of yet from OLD GA to NEW GA. So you will literally have to take off old GA code from your website and insert new GA Universal, thus creating a new Profile View.

      • Kristo Peterson says:

        Hey Ravey. Stumbled upon this page of yours and decided to join the discussion. There actually is a migration service from GA to UA (so-called “old GA”). Once you turn off all the not yet supported functions in UA (e.g. remarketing and demographics data) and accept the Data Amendment, there will pop up a “Transfer to Universal Analytics” option in Admin page under the property. This way you can take all your old data to the new system of UA and don’t need to create a new profile view. Cheers!

        • Ravey says:

          Oh this is a new thing recently added then? I noticed it in some of my GA accounts which I haven’t transferred yet, under the ‘admin’ section. Great!! Thank you for adding this Kristo.

  2. Marine says:

    I found your tutorial just a fiew minutes ago and i created the views and the filters straight after finishing reading it. I’m waiting for a few hours, because for now, the traffic is close from null, but it should be ok. And no matter if it doesn’t work : i would be the one to blame, because what you wrote is limpid. Thanks a lot.

  3. Cooper Fellows says:

    Hi Ravey, thanks for the solid write up, it was pretty easy to follow. Although I have an issue with the sub-domain view tracking set up. These views are not sharing campaign data across them. So if I visit http://www.example.com with UTMs (from the URL builder so I’m not screwing them up), then navigate to the subdomain, the traffic source in the sub-domain view is NOT the campaign that sent the visitor to the main domain, but is instead, (not set) / Direct, which seems odd, because the source should be Direct, and the medium should be, (not set), as is the case when looking at a standard report.

    I know that’s very vague, there are far more details in the post I created here: https://productforums.google.com/forum/#!msg/analytics/55XtbdlxfVc/RwW3fVMOex0J.

    Thanks again for the write up, it has helped on other accounts I’ve configured in the past.

    • Ravey says:

      In what area of the reports are you looking at your data? You should look at your URL builder reports in the {Acquisition > Campaigns} area. Since your subdomains and main domain share the universal code, the data will translate across domains. Your subdomains should not be seen as referring data. If so then you have missed overriding old Classic code or missed implementing some UA code on some pages of your website. Please share the reports/screenshots you are viewing and I will be able to help further. I also need to see the Campaign URLs you are creating. You can send to me@robertoavey.com if you wish.

  4. Andrew Taucher says:

    I have maindomain.com which is only a landing page with links off to subdomains (sub1.maindomain.com, sub2.maindomain.com, etc.) I set up the views exactly as this article states and my sub domains are tracking fine, along with my total view (which tracks all domains). The problem is that my maindomain.com view shows traffic to pages that live on the sub domains. Shouldn’t this only show traffic to the maindomain.com and not include stats for the sub domains? I double-checked how it was set up and everything is correct, along with the correct tracking code.

    • Ravey says:

      Hi Andrew,

      You did it right. STEP Three incorporates all sub domains and domains into one view. This way you can keep sessions between sub domains and view paths etc. Step TWO Should be ONLY “www View.” Remember I Only did a domain and sub domain here in the tutorial. I ended up with THREE VIEWS. You have TWO subdomains and a main domain so you should end up with FOUR VIEWS. Hope this helps.

      Regards,
      Ravey

Leave a Reply to Kristo Peterson Cancel reply

Your email address will not be published. Required fields are marked *