How to setup subdomain tracking in Google Analytics

How to setup subdomain tracking in Google Analytics

How to setup subdomain tracking in Google Analytics

Sometimes you might be in a situation when you would like to report data from your subdomain along with your main website domain. It could be blog.website.com, promotion.website.com or store.website.com or any other example.

By default, Google reports subdomain as a referral, and doesn’t let you see events happening on your subdomain.

Today we will have a look at a typical scenario when you sign up for a landing page creator, such as Unbounce, Leadpages or Landingi. We will connect Google Analytics to our subdomain, which will let us track the visitors from our paid campaigns, as well as their actions.

In the next posts, we will cover Tag Manager setup and event/conversion tracking for these tools.

This guide is created for the Google Analytics account that is already up and running.

First, we need to go to the “Admin” settings of your Website account (gear icon in the bottom left of your screen).
google analytics admin screen

Every time you try to add/edit functionality of your Google Analytics account, do so under a new view. That way if you make any mistakes, it doesn’t affect your main data. Now we will create a new view.

google analytics view creation

In the next screen you will be asked to name your new view, which could simply be “Show Subdomain”.

Create new view in Google analytics

Afterwards, click on the “Filters” menu option under your new view and click on “Add Filter”.

add new filter to the view in Google Analytics

On your next screen, give your filter a name, such as “Subdomain enabled” and select “Custom” from the “Filter Type” options.

filter settings for subdomain tracking in google analytics

By default, it goes to the “Exclude” option, and what you need to select here is “Advanced”, and fill out the fields as following:

Field A

Hostname: (.*)

Field B

Request URI (.*)

Output To

Request URI $A1$B1

Right below you will have 4 options – leave “Field A Required” and “Override Output Field” checked, whilst “Field B Required” and “Case Sensitive” should remain unchecked.

Hit Save.

advanced settings for filter in google analytics to track subdomain

Now we go back to the Admin dashboard and select “Referral Exclusion List” under the “Tracking Info” from the “Property Section”.

referral exclusion list under the tracking info in Google analytics

Click “Add Referral Exclusion”.

referral exclusion button

All we have to do here is to add our domain name in the simple form without any http or subdomain prefixes.

exclude domain from referral traffic in google analytics

Congrats! You have set up subdomain tracking for your Google Analytics account.

Important Point: It took me another 15 minutes to figure out why it was still not working. Turns out, I forgot about the filter we had set up for our own IP address. If you already have a filter in place, that filters out IP address of your home/company, make sure to temporarily disable it when testing subdomain tracking.

example of own ip address being filtered out in google analytics

All we have to do now is go to the Google Analytics account and check the Real-Time reports option and click on the “Overview”. Open up an incognito window in your browser and enter a page with the subdomain. If everything is correct, you will see an active user on your subdomain, that shows up under the main settings.

active session in google analytics on a subdomain

As you can see here, our Google Analytics account now tracks the subdomain for the paid campaign that refers users to the welcome.websitename.com created in a landing page builder.

If you are satisfied with the results simply add the filter to your main view to report subdomain stats. Don’t forget, it would only track subdomain data from the day you have added the filter.

If you are still struggling with your analytics account, get in touch with us through the contact form, we would be happy to help! We offer a variety of service in digital marketing, and Google Analytics is just one of many.


Head Office

#113-3855 Henning Drive
Burnaby,
BC V5C 6N3 Canada

Phone

Toll Free
in North America: 1-888-407-6937
Tel: 604.473.9700
Fax: 604.473.9080

Email

support@smartt.com

# Social media

Get a free proposal

Name