Setting up a custom filter in Google Analytics allows you to view and analyze your subdomain traffic separately from your main website. This type of custom filter is very useful for websites with a blog, landing page, or wholesale site that is part of an existing domain. Here’s a quick and easy guide on how to set up a filter in Google Analytics to track subdomains.
Step 1: Make sure Google Analytics is set up on your subdomain and that both domains are using the same UA code
This may seem pretty simple, but it’s important! If both websites are not using the same UA property, you will not see any data when you create the filter. You can use the Google Tag Assistant to check and make sure the code is installed correctly. Once the Universal Analytics code is set up for both websites, you’re ready to move on to the next step.
Step 2: Create a new view in Google Analytics
Creating a new view in Google Analytics is simple. Once you are logged into your Google Analytics account, click on Admin and make sure you have selected the right account and property from the drop down menus. Once you have completed this step, click on view, select create new view, and give this view a name. It can be as simple as “blog”, the actual web address of your subdomain – e.g. blog.subdomain.com, or whatever is easiest for you and your team to remember. As you can see in our example, I named the view “all blog traffic”.
If this is your first time creating a view for your Google Analytics traffic, it is a good idea/best practice to first create a test view with no filters applied. This ensures if you make a mistake, you will still have access to your unaltered, raw traffic data. Filters can be turned off, but they cannot be deleted and filtered data is permanently changed, so proceed with caution!
Final tip – make sure your time zone on your new view matches the time zone of your analytics property, otherwise you will get inconsistent data.
Step 3: Click on the new view you created for the subdomain and apply a custom filter
Now that you have created your view, make sure it is selected from the drop down menu on the admin panel and click on filters, + new filter, and select the create new filter radio button. Name your filter something that is easy to identify. Under filter type, select custom filter and click the include radio button. Under filter field, select hostname from the drop down menu and add your subdomain with backslashes before the periods. For example, if your subdomain is wholesale.testviewsite.com – enter it as wholesale\.testviewsite\.com
Once the previous step is completed, you can click the verify filter button to make sure it is working correctly, but this step is not necessary. Once you click save, your filter will begin collecting and displaying data within the next 24 hours.
Step 4: Add a referral exclusion to your Google Analytics property
Adding a referral exclusion on your website property will prevent the subdomain traffic from showing up as a self-referral and skewing your reports. To apply the referral exclusion, return to the admin menu in Google Analytics. Once your property is selected, click on tracking info and then referral exclusion list. Add your subdomain URL and click create.
And that’s it! Please let us know if you have questions and for more information on view filters, visit Google’s help section.
Also, if you need help using Google Analytics in general, we provide ongoing Analytics support for our clients. Contact us to learn more about how we may be able to assist you with tracking and interpreting your data.