This post is in response to Bavesh Gudhka’s question “How to prevent your own visits on Google Analytics?” on the LinkedIn Google Analytics Group. Bavesh wants to exclude internal traffic, so that when he’s checking how pages on his site are deploying, he won’t artificially inflate traffic.
There are some great suggestions in the responses to Bavesh’s question. Clearly there isn’t a one size fits all solution. ‘”It depends” definitely applies. Here are 3 tactics we recommend depending on the situation:
Exclude IP or ‘Service Provider’
- Works well if you and your colleagues all work from an office location with a fixed IP or IP range.
- Method fails when:
- Remote workers work from home or other office, outside the IP range or with a different service provider
- IP range changes (and your tech folks doesn’t tell you)
- Service Provider changes (and nobody informs you)
Forced Browser Home Page / Start Page
- Set up all your organization’s web browsers on organization controlled computers so that all visitors to begin their browsing sessions on an Intranet or specified subdomain that does not contain any Google Analytics code.
- Since the page does not Google Analytics code, it will be a referring ‘source’.
- Exclude all visits that are ‘referred’ from that URL or subdomain.
- Works well if you have control over all devices and can set the default home page on all computing devices.
- Method fails when:
- Employee or contractor uses home or non-corporate controlled device for work
- Browsers versions are updated and the default start page is removed
Set a Persistent Visitor Cookie using Custom Variable or Dimension
- In the Linkedin post comments, Anna Larsson recommended that a cookie be set that stops GA from tracking. The problem is that it disables all GA tracking, regardless of Profile/View.
- If you are testing code and want to be tracked, you’d have to remember to delete the cookie, test and then re-enable the opt-out cookie. In this case, your traffic will once again be visible in all profiles/views.
- Rather than an opt-out cookie, use another GA visitor cookie (this may be the ‘3rd service’ Daniel Gadpen alludes to in the Linkedin post comments). There are 3 possible cookies:
- User Defined: The ‘User Defined’ variable sets visitor cookies but has been deprecated for quite a while and could disappear at any time. Not recommended because of this.
- Custom Variables: You could use Custom Variables, but there are only 5. See instructions here on setting Custom Variables.
- Custom Dimension: Consider switching from standard Google Analytics (ga.js code) to Universal Analytics (analytics.js code), now in public Beta. Then you can then use a Custom Dimension (CD) to identify internal traffic. With Universal Analytics, you have 20 CD variables.
- Select a CD and set a value of ‘Internal Traffic’ by having insiders visit a page that sets this CD.
- Use a Filter to exclude all traffic where that Custom Dimension is equal to ‘Internal Traffic’.
- Periodically send out an email and ask users to click through to the landing page. Ask them to visit the page from all the browsers they use. It’s is usually the tech-savvy who will use more than the default browser, so this should not be a problem.
- Here’s the Google Developer article on custom dimensions & metrics. Remember that you have to be using Universal Analytics for this to work. Read our blog post about Universal Analytics.
We’ve recommended and have used all of the above, typically in combination. The most common are option 1 (IP or service provider exclusion) and a visitor cookie method, some variant of option 3, but not the full opt-out cookie.
Although the specifics might be different, the general strategies underlying the above tactics will work with other web analytics tools, not just Google Analytics.