1,566 total views, 6 views today
Your filtered view in Google Analytics should be your main view that you use for day-to-day analysis and reporting. And one of the first filters that you will want to configure in this key view is the “Include My Domain” filter. The reason for this filter is that you only want to include website traffic that goes to your domain.
Without an Include My Domain filter, spammers can cause you problems on Google Analytics. They can send data to your Google Analytics account if they know your Google Analytics tracking code, without even needing to visit your website at all.
Imagine if someone stole, or accidentally typed, your Google Analytics tracking code, and put it on their own website. Then whenever visitors went to this other website, all of the data included within it would be tracking into your Google Analytics account. Very irritating!
If a malicious spammer or competitor wanted to upset your business they could steal your Google Analytics tracking code, and add it to other websites. If you didn’t discover this quickly then your Google Analytics Account would effectively be rendered useless because you’d be receiving data from websites other than your own, and your data would no longer be trustworthy.
Obviously this is something that we want to eliminate as a possibility before it even happens!
So the first filter that we need to implement in order to make sure that we’re on top of the issue is an Include My Domain filter. This can be a Predefined or Custom Filter Type depending upon how many hostnames you need to include.
To set it up as a predefined filter, choose “Include only” > “traffic to the hostname” > “that begin with” > then add the hostname of your website. See the following image for an example:
Click Verify this filter before saving to see if there are any other hostnames that are coming through which will now be filtered out.
I also want to highlight the fact that in this filter I suggested selecting traffic to the hostname “that begin with” rather than “that are equal to” because sometimes Google will cache your website, and they will append .googlecache to your hostname. If instead you want to only include traffic to the domain that is exactly equal to your hostname then you can do that as well, but the cached pages will be cut out of your view. Personally, I like to include the cached pages, but it is completely personal preference and won’t make a lot of difference either way.
Creating a Filter Pattern using a Regular Expression
If you have multiple domain names, or if you have cross-domain tracking between your website and a payment gateway, there will be more complexity required in your filter. This is because each domain name will need to be included in your filter, otherwise they will be excluded from your view. To do this, you will need to create the filter as a custom filter.
In this case choose a Custom filter type and choose ‘Include’. In Filter Field pick ‘Hostname’. This will give you the option to add a Filter Pattern.
The Filter Pattern uses a Regular Expression to set the rule for what to include in your view. A Regular Expression is a way of filtering text using a rule. To write the Regular Expression for your own hostnames you can define it as follows:
^ ( host1 | host2 | host3 ) – i.e. this will include a hostname that begins with “host1” or begins with “host 2” or begins with “host 3”.
Important note: If you have more than one hostname and you want them all to show up in the same view you must put them all in the one filter rather than creating separate filters for each of them. If you have more than one Include filter in your Google Analytics view then it will only include data that matches both of the filters at the same time, not host1 OR host2. In the case of hostnames you never have more than one hostname at a time for any given URL, so if you had two separate Include hostname filters you would wipe out all your data completely and end up with an empty view.
Important note #2: If you have more than one top level domain (TLD) such as UK, US, AU etc and the currency changes in each case, you should set up a separate view for each and choose the appropriate currency in that view. Otherwise the currency will be converted in Google Analytics.
Google Analytics offers you a lot of marketing and commercial potential, but it’s important that you keep on top of the vulnerabilities that it also creates. By adding an Include My Domain filter to your filtered view, you will ensure that invalid host spam is kept out of your data. This secures your business, and potentially even gives you an edge over your (much spammed) competition.