Google Analytics (GA) is a powerful tool used to understand trends in behavior of visitors to your website. It helps with understanding whether customers are being pulled in to view further pages (bounce rate), whether the call-to-action on landing pages is effective (goals and funnels) as well as the success of your various marketing campaigns and social activity efforts to attract people to our site (campaigns and referrals).
But what if some of those groups of visitors are identifiable as not our potential market? How do we exclude them, so that their behavior doesn’t impact the data we are collecting?
There are a number of different kinds of users that fit into this category. The most obvious being people from your own company – internal users. As well, there are lots of “bots” in the internet that are visiting your website and acting as users, for various reasons. Some are harmless. They may be just trolling for data, such as a curating service. We actually don’t mind if they find us and link back to us. Others may be more malicious, such as spam services that want to leave trackback comments on your blog.
Depending on the amount of over-all traffic and the amount you get from these sources, you may not care that these are included in your metrics. In terms of traffic metrics, it’s really noise you would like to silence. You should, and need to have ways of dealing with these types of visitors from a security point of view outside of your traffic tracking. Still it’s nice to know that we could just not count them in the first place, and eliminate them from the Google Analytics data gathering. There are a couple of ways to do this.
Use Google Analytics Filters to exclude some traffic tracking
Within Google Analytics there is a way to filter out certain traffic from your tracking. This is done by applying a Filter to the View dataset. The Filter is setup in the administration section for a View.
GA Filters are quite powerful. They can be setup to exclude traffic, include traffic, and transform some of the information to do data corrections (like case changes). For this discussion, we are focusing on the exclude.
Once the Filter is setup, when the traffic data is sent to GA, it is tested against the Filter and if it applies, the data is ignored. Meaning… Filters are only applied to future data. As well, once you apply a Filter, you can’t retroactively remove it and view the data without it. If you are going to use GA Filters its good practice to first create a separate View of your data that does not include any Filters, and then a second View of your data where you apply Filters. That way you can compare the two to see that your Filter is actually working. You also have a View dataset to go back to if you decide later you need the information for some reason.
Since Google Analytics terms of service include a statement that you can’t uniquely identify and store information about users, the Filter conditions pertain to information about the visit not the visitor. With such things as IP address or Domain, device type, geographic location and referrer.
In the case of that spam service that is using a bot to view our site – we can at least identify and from our reports the strange referrer and then setup a Filter so that we don’t track their traffic. (And then separately have an anti-spam solution that identifies and excludes their comments as spam.)
Exclude sending some traffic tracking to Google Analytics
A little less known, there is also an ability to stop the traffic “hit” on a particular page being reported to Google Analytics at all. It’s discussed as an Opt Out feature within the developer pages covering coding the JavaScript to handle the traffic hit push to Google.
It requires some in-page JavaScript code that would test your exclusion condition, and then set a window property indicating that GA is disabled in this instance. ( window[‘ga-disable-UA-XXXX-Y’] = true; where UA-XXXX-Y is your GA web property id). If this is set, then the tracking information is not sent to Google Analytics during the page visit.
So when might you use this? Google Analytics suggests Filters as the solution for excluding your internal traffic by Filtering on your internal network IP range. But what if this team is virtual and using the website from various devices and places outside of your internal network? Then filtering on the IP range of your internal traffic would not exclude this traffic.
For a web property I own, we setup a private admin page where we are able to set a cookie in the browser. Then all website pages test for the presence of this cookie, and disables the traffic reporting if it is present. It did mean that we have to set the cookie on all browsers and all devices we want to exclude – a small pain, but at least a one-time activity.