How To Exclude Internal Traffic To Google Analytics
An important consideration in correctly setting up Google Analytics to avoid any data collection that skew a report, a major source for this kind of data is your internal traffic, especially if you have a big team generating traffic to your website.
Excluding traffic from a specific IP address is a popular method that perfectly filters out all web analytics data from all IP addresses you use to connect to the Internet. You have an option to filter out one or more IP addresses or IP ranges. However it has more cons than pros:
- Technically impossible if you don’t have a static IP address.
- Need to update when IP addresses change, like switching to a new internet provider.
- In a shared office, all local traffic from the office will be filtered.
- Won’t help when taking your computer to a coffee shop or a client meeting and using other networks with different IP addresses.
Using that method needs one or more filters on a profile, remember not to add a filter on the default profile unless necessary, always add a new profile first, and then follow these instructions to create an IP exclusion filter.
To overcome the issues with the above method, I suggest tagging your computers / browsers by setting a cookie on every internal device and then create a filter to exclude traffic from those devices.
To do so, add a new page to your website, and in addition to Google Analytics Tracking Code, add below line of code to the body of the page:
Now create a custom filter to exclude traffic from all the tagged devices. Use following settings:
If you don’t know how to create a custom filter, read these instructions here. Now visit the page with all your browsers on local computers to set the cookie everywhere.
Important Note: This page should be hidden from regular visitors, otherwise there will be risk of loosing all your traffic.
Now you are set, even if you take your laptop with you to a meeting out of the office, your traffic will be filtered.
Like the other method you also need to add this filter to all profiles except the default, and don’t forget to to visit the page every time you install or upgrade your OS or browser, or when you buy a new computer.