How to exclude internal traffic from Google Analytics using an IP address filter
For many organisations, the company website is used by staff on a daily basis as a go-to resource – which may well be exactly as you'd hoped – however, when it’s also the main marketing tool and a key measure of engagement with your desired audience, it becomes necessary to separate this internal traffic from visitor analytics so that the visitor data is not skewed.
Fortunately you can do this quite easily by using the IP address of each location where staff are working and then setting up a filter in Google Analytics which excludes this information.
What is an IP address?
An IP address (Internet Protocol address) is a unique string of numbers assigned to every device that is connected to a computer network and the internet. Although each device is given its own (local) IP address, this will only be used internally by the network (i.e. your home wifi network) and when you connect to the internet through a router, a common IP address will be given to all devices on that network for public use.
Therefore, when it comes to blocking IP addresses, you only need to find the IP address for the router / network, rather than every individual laptop, desktop and phone.
What is my IP address?
This bit is easy, Google will tell you! Just Google search, “what is my IP address?” and it will display your public IP for you.
If your company has a range of IP dresses, for example if there are multiple networks used within a large building, you should be able to find out what these are from your IT team.
You will also need to ask colleagues in other locations to complete the Google search and tell you their IPs. Likewise for freelancers or people working in remote locations.
In Google Analytics, you can either create filters at the account level and apply them to one or more views, or you can create filters at the view level that apply only to that view. A ‘view’ is a subset of your website analytics which can be uniquely configured (i.e. have multiple filters applied) whilst leaving the original data set unaffected so it is always there as a back-up. As a filter is permanent and cannot be reversed, it is therefore recommended to apply your IP filter at the view level.
If you need to create a new view, you can do this in the admin area of your analytics account.
Click the ‘+ Add Filter’ button and give your filter a name, here you can see ours is called ‘Exclude own IP address’.
The setting you need are as follows:
- Leave the Filter Type as Predefined.
- Click the Select filter type drop-down menu and select Exclude.
- Click the Select source or destination drop-down menu and select traffic from the IP addresses.
- Click the Select expression drop-down menu and select ‘that are equal to’.
- Enter the IP address and save.
If you have multiple IP addresses to exclude then you can simply repeat the process and create a new filter for each one.
Multiple IPs and subnets of IP addresses can also be excluded using a regular expression, which is a specific sequence of characters, for example:
This expression is excluding the address 184.108.40.206 and any subnets of 192.168.0.
To use a regular expression, you’d select ‘Filter Type: Custom’ in the filter settings, you’ll then be offered the option to choose a filter field, which should be set to ‘IP address’, and you can then enter the expression.
For information on creating regular expressions, head to the Analytics Help page.
Certain types of filters can be verified first before implementing, though this is not the case with the IP filter, so you’ll need to save the filter changes and then give it around 24 hours to come into effect. You can then compare the data in your view to the data in the original property to see that it is working.
Emily is one of our Account Managers and specialises in content and SEO. When she's not helping clients, she's usually travelling around in her campervan with Poppy, our resident sheepdog.