How to Set Up Google Analytics Host Name Filters and Segments
By: Steven Dilmore
Of course, the consequences behind tracking erroneous data from Google Analytics range from marginal to obstructive. And like us, you’ll want to find out what went wrong.
We first researched the source of the problem. We began by analyzing the tracking code that the client was using to pull data into Google Analytics. Word to the wise: that tracking code can’t be hidden from savvy web users. It exists in the header HTML of your site. So, a few things could have happened (and may happen to you). One, it could have been accidentally left on an old site that’s no longer monitored, which wasn’t the case for this client, since they never sold this type of product. Two, the issue could be caused by an external web user copying your tracking code and sending fake traffic to your site by adding it to their website. Why does this happen? A variety of reasons, two we’ve noticed:
- Competitor who wants to make your site unreliable
- Someone selling spam software to try to get you to invest in their software
Google offers two fixes to this, using either hostname segments or filters. Your hostname essentially tells Google to look at where that tracking code actually lives, so if it’s hosted on your domain name, and you’ve set up a filter or segment, Google Analytics will only honor the data that comes from your domain, not the data coming from these other sites.
Here’s a quick breakdown of these two solutions:
- Setup Hostname Segment: With this method, you won’t lose any data. There’s less risk involved in this case, and you just rebuild the segment and pull in the data as needed. Drawbacks? You’re still collecting that spammy or obsolete data, and you still need to reapply that segment every time you want to use it.
- Setup Hostname Filter: This is a more permanent solution. It applies a filter to a view and it won’t record that data at all. Drawback on this one? You do need to be careful that you configure the filter properly or you risk losing valuable data indefinitely. We recommend setting up a test first in order to initiate.
Who Benefits from Hostname Filters and Segments?
We recommend that any marketing or SEO expert should know how to set this up in Google Analytics. It’s probably not going to be a problem for a client who doesn’t have a lot of site traffic, or for companies who don’t have ecommerce, but it’s not unusual to see errors like this on any website. It certainly doesn’t hurt to use on every website just as a precaution to ensure that the data you’re pulling into analytics isn’t full of spam, archaic data from previous sites, or errors that ruin the metrics you’re trying to read. Of course, this is just one reason why you may be experiencing erroneous data on your website, and troubleshooting is tough, but this setup is simple enough and will ensure the data is coming from the right host.
About Steven Dilmore
As a Business Analyst at Aptera, Steven is a Professional Scrum Master and uses his knowledge to translate business goals into actionable requirements with a focus on delivering value. He specializes in coordinating stakeholders across continents.