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.- How it works
- Before you begin
- Identify patterns of bot spam in your reports
- Manager your custom condition traffic filter
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
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 |
|
|
| System and browser uniformity |
|
|
| Traffic acquisition anomalies |
|
|
| 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 |
|
|
Isolate exact filter values in Explore
Use session engagement metrics in a free-form exploration to confirm which attribute values to exclude:
- In Explore, select Free form.
- 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.
- Drag 2 or 3 suspected dimensions into Rows and the engagement metrics into Values.
- 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.
- 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
- Sign in to your Google Analytics account.
- 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.
- Select Create filter, then Custom condition traffic.
- Enter a unique Data filter name (up to 40 characters, starting with a letter and containing only Unicode letters, numbers, underscores, and spaces).
- Under Filter operation, confirm that Exclude is selected.
- 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.
- 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.
- 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:
- In Explore, under “Start a new exploration”, select Free form.
- 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.
- Drag Test data filter name and Event name into Rows, and drag the four metrics into Values.
- In the Filters panel, select Test data filter name choose contains, enter the exact name of your data filter, and click Apply.
- 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.
- 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:
- In Admin, under “Data collection and modification”, select Data filters.
- Select the Custom condition traffic filter you validated.
- Under Filter state, select Active.
- Select Save and confirm the prompt.