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.
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.
In the next screen you will be asked to name your new view, which could simply be “Show Subdomain”.
Afterwards, click on the “Filters” menu option under your new view and click on “Add Filter”.
On your next screen, give your filter a name, such as “Subdomain enabled” and select “Custom” from the “Filter Type” options.
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.
Now we go back to the Admin dashboard and select “Referral Exclusion List” under the “Tracking Info” from the “Property Section”.
Click “Add Referral Exclusion”.
All we have to do here is to add our domain name in the simple form without any http or subdomain prefixes.
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.
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.
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.