This article is about Google Analytics 4 properties. Refer to the Universal Analytics section if you're still using a Universal Analytics property, which will stop processing data on July 1, 2023 (July 1, 2024 for Analytics 360 properties).

[GA4] Filter out internal traffic

This article is for website owners who want to filter out data from internal traffic. This article pertains to Google Analytics 4 properties; if you are using Universal Analytics, read this article instead.

GA4 enables you to filter out internal traffic in web data streams. To filter out internal traffic, create a rule that defines the IP address or range of IP addresses that represent internal traffic. The definition of internal traffic that you create is used to set the traffic_type parameter which can then be used in your filters to include or exclude internal traffic.

When you create a definition of internal traffic, the traffic_type parameter is automatically added to all events and has the parameter value you specify. You can also manually add the traffic_type parameter to your event code (e.g., by modifying your gtag.js code) and give it any value you want.

 

Steps

To filter out internal traffic, do the following:
  1. Create a rule to identify internal traffic in your web data stream.
  2. Create a filter at the property level to exclude internal traffic.

Create a rule to identify internal traffic

You need the Editor role for the property to create, edit, and delete internal-traffic definitions. 
  1. In Admin, click Data Streams in the Property column.
  2. Click Web and then click a web data stream.
  3. In the web stream details, click Configure tag settings (at the bottom).
  4. Click Show all.
  5. Click Define internal traffic.
  6. Click Create.
  7. Enter a name for the rule.
  8. traffic_type is the only event parameter for which you can define a value. internal is the default value, but you can enter a new value (e.g., emea_headquarters) to represent a location from which internal traffic originates.
  9. Under IP address > Match type, select one of the operators (e.g., IP address equals).
  10. Under IP address, enter an address or range of addresses that identify traffic from the location you identified in Step 8. You can enter IPv4 or IPv6 addresses.
    The IP address field does not support the use of regular expressions (regex).
    The following examples show how to identify IP addresses for each operator:
    • IP address equals: 172.16.1.1
    • IP address begins with: 10.0.
    • IP address ends with: .255
    • IP address contains: .0.0.
    • IP address is in range (ranges need to be expressed in CIDR notation):
      • 24-bit block (e.g., 10.0.0.0 – 10.255.255.255): 10.0.0.0/8
      • 20-bit block (e.g., 172.16.0.0 – 172.31.255.255): 172.16.0.0/12
      • 16-bit block (e.g., 192.168.0.0 – 192.168.255.255): 192.168.0.0/16
  11. You can set multiple conditions to identify internal IP addresses using the Add condition button.
    If multiple conditions are set, they are joined by an implied OR operator. In other words, IP addresses that match any one of the conditions will be marked as internal traffic.
  12. Click Create.

Using CIDR notation

Classless Inter-Domain Routing (CIDR) notation is a way to represent ranges of IP addresses.

The following examples use IPv4 addresses. CIDR-notation syntax is the same for IPv6 addresses.

IPv4 addresses are 32-bit binary numbers with the values for each octet ranging from 0-255.

For example, the IPv4 address

10.10.101.5

has the 32-bit binary equivalent of

00001010.00001010.01100101.00000101

When you express a range of IP addresses in CIDR notation, you indicate how many of the bits are fixed and how many can be of any value. For example, the CIDR notation for the range of addresses 192.128.255.0 - 192.168.255.255 is 192.168.255.0/24.

/24 indicates that the first 24 bits (192.128.255) are fixed and the last 8 bits (.0) are wildcards that can take any value (0 is the standard wildcard).

If you needed to indicate a range of 192.168.0.0 – 192.168.255.255, you would indicate that the first 16 bits of the address are fixed: 192.168.0.0/16.

/16 indicates that the first 16 bits (192.168) are fixed and the last 16 bits (.0.0) are wildcards that can take any value.

If you were using IPv6 addresses and wanted to express a range, you would use the same "slash-number" suffix to indicate how many bits of the range are fixed. For example, if the range were 0:0:0:0:0:ffff:c080:ff00 - 0:0:0:0:0:ffff:c080:ffff, you would express the range as 0:0:0:0:0:ffff:c080:ff00/120 (the first 120 bits are fixed).

Learn more about CIDR notation.

Edit your internal traffic definition

  1. In Admin, click Data Streams in the Property column.
  2. Click Web and then click a web data stream.
  3. In the web stream details, click Configure tag settings (at the bottom).
  4. Click Show all.
  5. Click Define internal traffic.
  6. Click the row for the definition.
  7. Click Edit.
  8. Make the changes you want, then click Save.

Delete your internal traffic definition

  1. In Admin, click Data Streams in the Property column.
  2. Click Web and then click a web data stream.
  3. In the web stream details, click Configure tag settings (at the bottom).
  4. Click Show all.
  5. Click Define internal traffic.
  6. Click the row for the definition.
  7. Click More (in the top right).
  8. Click Delete.

Related resources

Data filters

Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue

Search
Clear search
Close search
Google apps
Main menu
Search Help Center
false
false
true
69256
false
false