It’s not uncommon to want to remove a whole section of your website from a Google Analytics view. Luckily we can exclude a subdomain in Google Analytics. Websites often have subdomains for various parts of their websites. Often they are archives, eCommerce stores, or login areas for users. A login area is probably the most common(account.yourwebsite.com). While these are important parts of the site, we wouldn’t necessarily need them in a Google Analytics view.
Create a filter
To get started, Go to View settings and click on “filters.” Once you’re in filters click on “ADD FILTER.”
Once you’re in the create a filter screen select the appropriate settings.
- Create a new filter
- Give the filter a name example: “Remove Account Subdomain”
- Select Predefined
- Select “Exclude”
- Select “traffic to the hostname”
- Select “that contain”
- Input the hostname you are trying to exclude from the Google Analytics view. Example: account.yourwebsite.com
- Click “Save”
And you’re done. that’s how you exclude a subdomain from Google Analytics
Things to keep in mind
- Filters are not backward-looking. The filter only applies to new data that comes in after implementing the filter. The filter will not be applied to past data. This is why it is important to have a backup view that contains all the raw data.
- Filters are unforgiving. Filters will block all new incoming data, and there is no way to get it back. If there is a typo in your filter this can be problematic. So it is best practice to test your filters for a given amount of time before implementing them. And again, have a backup view that contains all the raw data.
- After you implement the filter, traffic from that subdomain will come in as a referral. If this is a problem you can use referral exclusion as a way to counteract that.
- If you switch the “exclude” to “include” you can create a view that only looks at traffic on those subdomains. This can be a helpful strategy in organizing your data.
To learn more about filters, I suggest the Google Analytics official documentation. If these terms are a bit advanced for you I recommend checking out my Google Analytics glossary or you can download my free Google Analytics eBook to learn more.