Filter Custom condition traffic in Google Analytics

Discover how to exclude automated scripts, scrapers, and other unwanted traffic from your Analytics reports using custom attribute rules.
Experiment icon for Gradual feature rolloutGradual feature rollout: The custom traffic data filter type may only be visible to eligible properties.
Important: Data filters only apply to new incoming data from the time they’re activated and don’t change historical data in your reports. When it’s active, excluded data is permanently dropped and never processed in Google Analytics or exported to BigQuery. To hide data temporarily or filter historical date ranges, apply filters to detail reports instead.
Google Analytics automatically excludes traffic from known bots and spiders. If automated scripts, commercial price scrapers, or headless browsers mimic standard web browsers and generate unengaged traffic spikes in your property, you can create a Custom condition traffic data filter to permanently exclude future matching events.

Example

An ecommerce site observes a sudden surge of 0-second single-page visits coming from a single data-center city using one older browser version. Creating a Custom condition traffic rule combining that city, browser version, and screen resolution keeps future scraper hits out of reports and Analytics 360 billable event counts.
On this page

How it works

When an event arrives at Google Analytics, active data filters evaluate the event attributes before processing:

Incoming event → Matches active Custom condition traffic rule → Event dropped before processing

  • Exclude only: Custom condition traffic filters only support the Exclude operation, so overly narrow rules can’t accidentally drop valid customer traffic.
  • Multi-condition precision: You can combine multiple attribute rules using AND and OR logic to target narrow bot signatures rather than broad single dimensions.
  • Excluded everywhere: Dropped events don’t appear in standard reports, Explorations, the Google Analytics Data API, or BigQuery exports, and they don’t count toward Analytics 360 billable event volume.
  • Property limit: You can create up to 10 data filters per property.

Supported dimensions

You can build Custom condition traffic filter rules using any combination of the following event-level attributes:

  • Geography: City, Region, Country
  • System and device: Browser, Browser version, Operating system, OS version, Screen resolution, Device category, Device model, Platform
  • Traffic source: Source, Medium
  • Page: Page path
Tip: To filter traffic from unauthorized domains using your Measurement ID, check Filter web hostname traffic in Google Analytics. To exclude traffic from known corporate IP addresses, check Filter out internal traffic.

Before you begin

You need the Editor role or higher at the property level to create, edit, and delete data filters.

Identify patterns of bot spam in your reports

Automated traffic behaves differently from real visitors and leaves recognizable patterns in your data. Before creating a filter, check your standard reports or build a free-form exploration to identify the specific dimensions associated with the unwanted traffic.

Common bot traffic characteristics

Anomaly category What to look for Dimensions and metrics to check
Geographic anomalies
  • Unexpected locations: Sudden, high-volume traffic spikes from cities, regions, or countries where your business doesn’t operate, ship, or advertise.
  • Non-residential concentrations: Disproportionate traffic volume coming from a single small town or non-residential area rather than major population centers.
  • Missing location data: Large surges where City or Region is reported as (not set).
  • City
  • Region
  • Country
System and browser uniformity
  • Identical device profiles: Real user traffic spans a wide variety of browsers, operating systems, and screen sizes. Automated traffic often uses a single hardcoded configuration. For example, 100% of a traffic spike coming from a single browser version or a single desktop operating system.
  • Unusual or missing screen resolutions: Automated browsers often fail to report normal screen dimensions, logging a single unusual resolution or (not set).
  • Outdated OS or browser versions: Sudden traffic surges from obsolete operating system or browser versions.
  • Browser
  • Browser version
  • Operating system
  • OS version
  • Screen resolution
  • Device category
  • Device model
  • Platform
Traffic acquisition anomalies
  • Sudden Direct traffic spikes: Sharp, unexplained increases in (direct) / (none) traffic caused by scripts requesting URLs directly.
  • Referral spam: Unnatural traffic spikes where 100% of the anomalous visits come from a single unfamiliar or promotional referring domain. For example, spam-referrer.example.com
  • Source
  • Medium
Repetitive page scraping Targeted page hits: Flat, uniform hourly traffic hitting only specific URLs, such as only your homepage or specific product catalog paths, without navigating elsewhere on your site. Page path
Low session engagement
  • Single-event sessions: A near 100% rate of 1.00 Events per session, like a single page_view with no further interaction.
  • Zero engagement time: 0 seconds of Average engagement time per session and a near 0% Engagement rate.
  • No conversions: Zero key events and no progression through your site's conversion funnels.
  • Average engagement time per session
  • Events per session
  • Engagement rate/Engaged sessions
  • Key events

Isolate exact filter values in Explore

Use session engagement metrics in a free-form exploration to confirm which attribute values to exclude:

  1. In Explore, select Free form.
  2. In the Variables panel, add suspected dimensions. For example, City, Browser versionand Screen resolution, as well as engagement metrics such as Sessions, Engaged sessions, Engagement rate, Average engagement time per session, Events per session, and Key events.
  3. Drag 2 or 3 suspected dimensions into Rows and the engagement metrics into Values.
  4. Sort by Sessions descending and find high-volume rows where Events per session is near 1, Average engagement time per session is 0 seconds, and Key events is 0.
  5. Record the exact dimension values from those rows to enter into your filter rule.

Manager your Custom condition traffic filter

Step 1 of 3: Create a data filter in the testing state

 

  1. Sign in to your Google Analytics account.
  2. In Admin, under “Data collection and modification”, click Data filters.
    Note: The previous link opens to the last Analytics property you accessed. You must be signed in to a Google Account to open the property, and you can change the property using the property selector. You must have the Editor role or above at the property level to create a data filter.
  3. Select Create filter, then Custom condition traffic.
  4. Enter a unique Data filter name (up to 40 characters, starting with a letter and containing only Unicode letters, numbers, underscores, and spaces).
  5. Under Filter operation, confirm that Exclude is selected.
  6. Under Filter conditions, select a Dimension (for example, City, Browser version, or Screen resolution), select a Match type (exactly matches, begins with, ends with, or contains), enter the exact Value from your reports, and click Add condition to combine attributes with AND or OR logic.
  7. Under Filter state, select Testing so Analytics keeps all incoming data and labels matching events with the Test data filter name dimension before permanent activation.
  8. Select Create, then Done.

Step 2 of 3: Validate your traffic filter

Wait 24 to 36 hours after creating a filter in the Testing state for Analytics to label incoming events, then verify that your filter matches only unwanted traffic and no legitimate customer conversions:

  1. In Explore, under “Start a new exploration”, select Free form.
  2. In the Variables panel, add Test data filter name and Event name under Dimensions, and add Event count, Sessions, Engaged sessions, and Key events under Metrics.
  3. Drag Test data filter name and Event name into Rows, and drag the four metrics into Values.
  4. In the Filters panel, select Test data filter name choose contains, enter the exact name of your data filter, and click Apply.
  5. Review the table results to confirm that the flagged Event count matches your expected bot volume and that Engaged sessions and Key events are 0 (or near zero) before activating.
  6. Verify human traffic exclusion risk. Double-check your filter definitions carefully before activating to confirm that legitimate users won't be accidentally excluded by overly broad matching rules. To evaluate impact to likely users, look at the inverse of the signals from step 1, which are used to identify bots. For example, ensure you won’t be filtering out significant key events or traffic with high session duration times.

Step 3 of 3: Activate your traffic filter

After you confirm that the filter isolates only unwanted traffic, set it to Active to permanently exclude future matching events:

  1. In Admin, under “Data collection and modification”, select Data filters.
  2. Select the Custom condition traffic filter you validated.
  3. Under Filter state, select Active.
  4. Select Save and confirm the prompt.
Note: After you set a data filter to Active, it begins permanently filtering incoming data within 24 to 36 hours.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
7880311845627912394
true
Search Help Center
false
true
true
true
true
true
69256
false
false
false
false
false