Introduction

When analyzing website performance in Google Analytics 4, it’s crucial to ensure that the data you’re reviewing reflects actual user behavior. Traffic from your internal teams can skew your data, leading to inaccurate results. 

In Google Analytics 4 (GA4), excluding internal and developer traffic is essential for maintaining clean and reliable reports. Whether you’re testing new features, performing updates, or troubleshooting, keeping this traffic separate helps ensure that your website metrics paint a true picture of how real users interact with your site. 

In this guide, we’ll walk you through the steps to effectively exclude this traffic in GA4, so you can trust the accuracy of your analytics.

We do this using two methods 

  • Method 1: Using IP Address Filter in Google Analytics
  • Method 2: Using WordPress plugin Monsterinsights (Only for WordPress User Roles)

Methods to exclude internal traffic 

Method 1: Using IP Address Filter in Google Analytics

What Is Internal Traffic?

Internal traffic refers to visits to your website made by people within your organization, such as employees or stakeholders, which you may not want to include in your analysis. By excluding internal traffic, you can ensure that your data reflects genuine user behavior and external visitor activity.

Limitations with IP Address Filters

In Google Analytics 4 (GA4), IP address filtering is commonly used to exclude internal traffic from reports, helping to keep data cleaner and more accurate. However, this approach has its limitations.

Here are the limitations of IP address filters in GA4:

  1.  Dynamic and Rotating IP Addresses
    • Many Internet Service Providers (ISPs) assign IP addresses dynamically, meaning they change periodically. Employees working from home or in coworking spaces may not have a static IP, making it difficult to maintain accurate filters.
    • This makes it difficult to maintain an up-to-date list of internal IPs for exclusion.
  2. Multiple Office Locations and Remote Work: 
    • If a company has multiple offices or remote employees, filtering based on IP addresses can become cumbersome. Each location and remote worker might have different IPs, making it challenging to cover all variations accurately.
  3. Use of VPNs: 
    • Employees accessing the website through a VPN will make it harder to filter their traffic accurately.
    • They may appear to access websites from various IPs each time they connect through a different VPN server.
  4. Mobile and On-the-Go Access:
    • If employees access the website from mobile devices on different networks, their IP addresses vary, further complicating exclusion.

If IP addresses are not updated regularly, internal traffic may slip through, distorting the analytics data.

Excluding internal traffic using IP filter

  • Login to Google Analytics 4 
  • Click the Admin menu (gear icon) at the bottom left corner.
Click on the Admin menu icon

Screenshot 1: Click on the Admin menu icon

  • Click on the Data Streams subtab under the Property Settings Data Collection and Modification section, as shown in screenshot 2 below.
Data streams Tab

Screenshot 2: Data streams Tab

  • Click on the Data stream. There are three options of streams: iOS, Android, & Web. Choose Web. You can’t filter out internal traffic from app users.
Select the stream to exclude internal traffic 

Screenshot 3: Select the stream to exclude internal traffic 

  • A Web stream details slide-over will open. Scroll down to the Google tag section and click on Configure tag settings.
Google tag → Configure tag settings

Screenshot 4: Google tag → Configure tag settings

  • A Google Tag slide-over will open. Scroll down and click on Show more at the bottom of the slide-over.

Screenshot 5: Click on Show more 

  • After that, click on Define Internal traffic under the Settings section as shown in the screenshot below to define IP addresses of which traffic should not be considered.
Define Internal traffic

Screenshot 6: Define Internal traffic

  • A Define internal traffic slide-over will open. Click on the Create button to add internal traffic rules as shown below.
Create traffic rule

Screenshot 7: Create traffic rule

  • Under the Rule name text box, you can give a name to your filter. Let’s name it Internal Traffic to simplify things.
Rule name

Screenshot 8: Rule name

  • Under the traffic_type value, you can define the name. The default value is internal.
  • Note: This is the only event field in Google Analytics 4 where a value can be assigned. Instead of using “internal,” you may choose an alternative value, such as “india_hq,” to identify the source of internal traffic.
traffic_type value

Screenshot 9: traffic_type value

Match Types
  • This is where you enter the IP addresses that you want to exclude from Google Analytics 4. 
  • You can enter either IPv4 or IPv6 addresses. Also, CIDR notation can be used to define groups of IP addresses.
  • The following is a list of match types.
  • IP addresses equals: This setting will match only one IP address.
    • For example, a value of 192.168.1.1 will only exclude that IP address 
  • IP address begins with: This match type will match all IP addresses that begin with the given input.
    • For example, if IP addresses begin with 192.168.—matches 192.168.1.1, 192.168.0.5, etc.
  • IP address ends with: This match type will match all the IP addresses that end with the given input.
    • For example, if it ends with 1 — Matches 192.168.1.1, 10.0.0.1, etc.
  • IP address contains: This match type will match all the IP addresses that have the given string in them.
    • For example, if IP has 168 —  Matches 192.168.1.1, 10.168.0.1, etc.
  • IP address is in range (CIDR notation): This option will match a group of IP addresses.
    • For example, 192.168.0.0/24  — Matches any IP from 192.168.0.0 to 192.168.0.255.
    • IP address matches regular expression: This option will match a set of IP addresses using a specified pattern.
      • For example, ^192\.168\.0\.\d{1,3}$ — Matches any IP from 192.168.0.0 to 192.168.0.255.
  • You can add multiple conditions to filter out IP addresses.
Internal Traffic rules configuration

Screenshot 10: Internal Traffic rules configuration

  • Note: In GA4, you can’t use regular expressions in the IP address field other than regular expression Match Type as shown below.
Regular expression match type

Screenshot 11: Regular expression match type

Example of Filtering an IP address

  • Let’s add an IP address to filter it out. You should enter the IP addresses that you wish to filter out. 
  • For example, let’s use the 172.16.1.1 IP address, which is a private IP address. 
  • Another example is that you can enter your own device’s IP address. To get your Public IP addresses, click on the link What’s my IP address? as shown in screenshot 12 or search on Google for What is my IP.
  • You will be redirected to the Google search page, where you can copy your IP address as shown in screenshot 12 below.
What's my IP address Google search

Screenshot 12: What’s my IP address? Google search

  • Once you have copied your IP address (IPV4 or IPV6), paste it in the value textbox as shown in screenshot 13 below.
IPv4-based IP address

Screenshot 13: IPv4-based IP address

Add multiple conditions

Screenshot 14: Add multiple conditions

  • You can enter multiple IP addresses into the filter. All of them will be filtered through OR logic.
  • Once you have entered all the IP addresses, click the Create button.
Create Internal traffic rule

Screenshot 15: Create Internal traffic rule

  • Your internal traffic rules will be saved as shown in screenshot 16 below.
  • That’s it. You have added the IP address that should be skipped from your GA4 data collection.
New Internal traffic rule

Screenshot 16: New Internal traffic rule

  • Caution: Applying a data filter has a lasting impact on your data. For instance, using an exclude data filter means the excluded data is never processed and won’t be available in Analytics or BigQuery. To temporarily hide data in specific reports without permanently excluding it, consider using report filters instead.

Testing the excluded internal traffic

  • In Google Analytics 4 (GA4), testing the filters to ensure they work correctly after setting them up is important. 
  • This process helps ensure that the data from internal users like employees, content writers, or administrators is not being tracked, making reports more accurate.
  • Head over to AdminProperty Settings Data collection and modification.
Property Settings → Data collection and modification

Screenshot 17: Property Settings → Data collection and modification

  • Click on the right arrow as shown in the above screenshot. Scroll down to the Filter state section.
Filter state is set to Testing

Screenshot 18: Filter state is set to Testing

  • By default, the filter state is set to Testing. If it‘s not set the Filter state to Testing
  • Note: This step is important for testing the IP address that you have entered in the previous step. 
  • Since the filter state is set to Testing any matching data will be labeled with the “Test data filter name” dimension, which is discussed in the next step.
Using Comparisons in Realtime Report
  • Head over to the Reports main tab under the Home Tab and then click on the Realtime overview sub-menu.
  • Click on Add comparison on the Realtime overview panel as shown in screenshot 19 below.
Realtime overview

Screenshot 19: Realtime overview

  • Apply a comparison slide over the panel will open up. Click on the Create New button as shown in screenshot 20 below.
Add comparison

Screenshot 20: Add comparison

Create a comparison

Screenshot 21: Create a comparison 

  • A create comparison screen will be shown.
  • Enter the following conditions
    • Dimension: Test data filter name
    • Match type: exactly matches
    • Value : Internal traffic
Add Test data filter name condition

Screenshot 22: Add Test data filter name condition

  • Click the Apply button.
  • You would see and compare All Users and Test data filter name exactly matches Internal Traffic as seen in the screenshot below. 
Comparison of All Users and Test data filter name exactly matches Internal Traffic

Screenshot 23: Comparison of All Users and Test data filter name exactly matches Internal Traffic

  • Go to Realtime overview page in Google Analytics 
  • Scroll to Views by Page title and screen name on the Realtime Overview page. 
  • Now visit any page of your website from the IP address that you entered above.
  • You will see the active user (The user with the IP address that you entered) on the right-hand side of the comparison bar chart highlighted in orange.
  • That is you have successfully tested the filter and it’s working.    
  • Troubleshooting:
    • If for any reason you are not able to see data in the comparison report of the Test data filter name exactly matches Internal Traffic check the IP address that you have entered. If the IP has changed re-enter the new IP address.
    • Also, the Filter state should be set to Testing as set in the screenshot number of step 2 

Activating the Internal traffic data filter 

  • Close all the slideover panels and navigate back to the admin section of your GA4.
  • Under the Property Settings expandable section, select Data Collection and Modification.
  • Under which click on Data filters
  • Click on the → arrow to Edit the Data filter 
Property Setting → Data collection and modification → Data Filters

Screenshot 24: Property Setting → Data collection and modification → Data Filters

  • An Edit data filter slideover panel will open.
  • Scroll down to Filter state and then Activate or Inactive (Deactivate) your filter.
Edit Data Filter Slideover

Screenshot 25: Edit Data Filter Slideover

  • Click on the Save button. 
  • You’ll get the message, “Filter changes are by nature destructive and irreversible. They are also not retroactive. You should only enable this if you have already successfully tested your filter.”
  • Click on the Activate filter.
Activate Filter

Screenshot 26: Activate Filter

  • Another method to activate or deactivate the filter is by clicking on the three dots on the right of the filter name, as shown screenshot 27 below.
  • That’s it your filter is applied and all the data collection from the filtered IP address is skipped.
Activate and Deactivate the filter

Screenshot 27: Activate and Deactivate the filter

Method 2) Using the WordPress plugin Monsterinsights (only for logged-in users)

  • The MonsterInsights plugin for WordPress makes it easy to exclude internal traffic by targeting WordPress roles.
  • Administrators of websites can use this method to stop data from being collected on the actions of logged-in users like site owners, editors, and contributors. 

Limitations with the MonsterInsights method

  • For this method to work you need to register all the users and assign them a role which will be then used to exclude them from GA4

Excluding Logged in user from Google Analytics 4 

  • Let’s get started with setting up MonsterInsights. If the plugin is already installed and Google Analytics is already connected, skip to the Add WordPress user roles to excludea section of this article.
Install the Plugin & Connect Google Analytics + Monsterinsights
  • Click on the Add New plugin button as shown in screenshot 28 below.
Add New Plugin

Screenshot 28: Add New Plugin

  • Search MonsterInsights in the search plugin text box.
  • Click on Install Now.
Install the Plugin

Screenshot 29: Install the Plugin

  • Click on Active to activate the Monsterinsights plugin.
Activate the Plugin

Screenshot 30: Activate the Plugin

  • Launch the wizard 
Launch the wizard

Screenshot 31: Launch the wizard

  • Select the category that best describes your website
Select the website category

Screenshot 32: Select the website category

  • You will be shown a Connect Monsterinights to your website screen. Click on Connect Monsterinsights.
Connect Google Analytics + WordPress

Screenshot 33: Connect Google Analytics + WordPress

After that, the Connect to Google Analytics screen will be shown. Click on Continue and connect to Google.

Connect to Google Analytics

Screenshot 34: Connect to Google Analytics

  • Choose the Google account associated with Google Analytics.
Choose the Analytics account 

Screenshot 35: Choose the Analytics account 

  • Next, Sign in with Google.
Sign in with Google 

Screenshot 36: Sign in with Google 

  • Give Monsterinsights access to the Analytics account.
MonsterInsights access to Google Account

Screenshot 37: MonsterInsights access to Google Account

  • Once the account is connected you will see all your Google Analytics properties. Choose the one of which you would like to see reports and filter users from GA4 data collection.
Choose an Analytics Property

Screenshot 38: Choose an Analytics Property

  • Next a Recommended settings screen will be shown, choose them as per your needs  
Choose Recommended settings as per your needs 

Screenshot 39: Choose Recommended settings as per your needs 

  • Click on Save and continue
Website features would you like to enable

Screenshot 40: Website features would you like to enable

  • Next, the page which features you would like to enable will be shown.
Wizard completed

Screenshot 41: Wizard completed

  • Click on Complete Setup without Upgrading 
Settings General Tab

Screenshot 42: Settings General Tab

  • You will be redirected to Settings General tab page. 
  • Until now we have Installed the Monster Insights plugin and connected it with Google Analytics. Now let’s exclude the WordPress User roles from Google Analytics 4. 
Add WordPress user roles to exclude
  • Under Settings Advanced Tab go to the Permissions section
  • Under the Exclude These User Roles From Tracking setting enter the User roles that should be excluded from tracking.
Exclude User roles from tracking

Screenshot 43: Exclude User roles from tracking

  • That’s it! You’ve now stopped tracking visits from the specified WordPress user roles in Google Analytics.

Conclusion

It is important to keep data clean and accurate in Google Analytics 4 (GA4) by excluding internal traffic. In this blog, we’ve looked at two ways to exclude internal traffic in Google Analytics 4 (GA4). 

In Method 1, we talked about how to use GA4’s data filters to block internal traffic. IP address filters are a simple way to keep internal traffic out, but they have their limits, especially in today’s flexible and remote work settings.

In method 2 we discussed excluding WordPress user roles from GA4 data collection.

By using these methods, you can improve the accuracy of your GA4 reports, enabling better decisions and clearer insights.