How to exclude IP address in Google Analytics 4

  John /    Updated on 09 Nov 2023
How to exclude IP address in Google Analytics 4

Google Analytics is a web traffic tracking tool that you can use on your website to track and measure its performance traffic-wise.

In as much as you want more traffic to your website, you definitely would also want Google Analytics to show you legitimate and accurate stats that are a true reflection of how your website is performing.

Being the website owner or manager you are likely to frequently visit your website. Other people close to you such as the marketing team/assistant, employees, friends, and family members who know your website are also likely to visit it repeatedly. Unless you tell Google Analytics not to, it will continue to count these visits and page views and present them in its stats among other visits.

This traffic can pollute the average data shown in GA. For instance, if you visit your website multiple times, spend hours on it, and visit multiple pages per visit, the average number of visits, page views, and session duration will be affected giving an overall false impression.

To avoid this, you need to filter out all the IP addresses that you don’t want Google Analytics to count.

In this article, you will learn how to exclude/filter out some IP addresses (internal traffic) from Google Analytics stats

How to check your IP address

If you don't already know your IP address, you can easily check it by visiting ping.eu

How to check your ip address

Alternatively, you can simply search on Google "my IP" and it will show your IP address as shown below.

How to check your ip address on Google

In case you don't share the same local network with the rest of the people whose traffic you want to block in Google Analytics reporting, just ask them to do the same and share the IP addresses with you. That's if they access your website while connected to the internet via a home or office network. If they use mobile data, that will not be necessary as the IP addresses are dynamic in that case.

How to block an IP address in Google Analytics (GA)

Now that you have the IP addresses of the internal traffic that you want to block, let's go through the step-by-step process of blocking them in Google Analytics reporting:

Step 1: Log in to your Google Analytics account via https://analytics.google.com/.

If you have more than one property(website) in your account, select the one that you want to block IP address(es) from via the dropdown menu at the top-left corner.

Step 2: Navigate to the Account admin page by clicking on the "Admin" link(gear icon) at the bottom-left corner of the page.

Navigating to Google Analytics Admin page

Step 3: On the admin page, click on the "Data Streams" option under the Data collection and modification section.

Google Analytics Admin page

Step 4: Click on the data stream. In case you have more than one data stream, then select the one you want to block/exclude the IP address.

Selecting a data stream in Google Analytics

Step 5: Scroll down to the "Google tag" section and click on "Configure tag settings".

Google Analytics configure tag settings

Step 6: Scroll down to the "Settings" section and click on "Show more" to view all tag settings.

Google Analytics show all tag settings

Step 7: Click on the "Define Internal Traffic" option.

Google Analytics define internal traffic

Step 8: Click on the "Create" button to set a new rule for IP blocking.

Google Analytics create new internal traffic rule

Step 9: Enter the configuration details. Give "Rule Name" any name that is relevant to the IP address being blocked. Leave "traffic_type value" as it is. Select "IP address equals" in the "Match type" dropdown and then enter the IP address you had earlier checked in the "Value" field under the IP addresses section. Then click on the "Create" button at the top-right corner.

Under the IP addresses section, you can choose a different option in the match type dropdown and enter a relevant entry in the value field.

This section also gives you the option to check your IP address on Google.

Google Analytics creating an internal traffic rule

You will be redirected back to the Internal traffic rules page where you will be able to see the new rule you just created listed down. In case you have multiple IP addresses that you want to block, just click on the "Create" button and repeat the same process.

Google Analytics list of internal traffic rules

Once you are done adding rules, close all the tabs and return to the admin interface.

Step 10: Click on the "Data Settings" option in the right column then on "Data Filters" under it.

Google Analytics Data settings options

Step 11: Click on the "Create filter" button to create a new data filter.

Creating a new Data filter Google Analytics

Step 12: Select the "Internal traffic" option under the data filter types.

Creating a new Data filter Google Analytics

Step 13: Give the data filter a name, select the Active filter state, and then click on the "Create" button at the top-right corner to create the filter.

Google Analytics Data filter settings

You will be prompted to confirm. Click on the "Activate filter" button.

Confirming Google Analytics Data filter settings

That's it. With the above steps, you are done excluding IP address(es) from being counted and shown in Google Analytics 4 reports.

The current records will remain as they are but new visits from the blocked IP addresses won't be recorded in the future.

Conclusion

As a website owner, you and some people close to you such as employees, family, and friends are likely to be the most frequent visitors to your website. After adding Google Analytics to your website to track traffic, it will continue to count your visits and page views unless you tell it not to.

Your visits and internal traffic can pollute the stats and create a false impression. I'm sure you would like to see legitimate and accurate stats that are a true reflection of how your website is performing.

In this article, we have covered the procedure of blocking IP addresses from Google Analytics traffic stats, both in GA4 and older GA generation.

It's my hope that you have found this article useful and easy to follow.