Sub topic 8
Excluding Developer Traffic with `debug_mode`
Assume you have a GA4 web data stream, Editor or Administrator access, and a basic understanding of events and data filters. This chapter focuses on developer traffic, which is different from internal traffic identified by office IP addresses.
Why developer traffic needs a separate filter
Developer traffic is generated while you test a site or application. You might open pages repeatedly, submit test forms, or trigger events while checking an implementation. These events can inflate views, sessions, conversions, and other reports.
GA4 identifies developer traffic when an event contains the debug_mode parameter with a value of 1. You can add this parameter to your Google tag configuration or to selected events. GA4 then makes the events available in DebugView and classifies them as developer traffic.
A developer traffic data filter can exclude these events from normal reporting. The filter does not remove events from DebugView, so you can continue inspecting them during implementation work.
flowchart TD
A[Developer opens the site] --> B[Tag sends debug_mode]
B --> C[GA4 classifies event as developer traffic]
C --> D[Event appears in DebugView]
C --> E{Developer traffic filter}
E -->|Testing| F[Used for validation]
E -->|Active| G[Excluded from standard reporting]Set `debug_mode` in the tag
With gtag.js, set debug_mode to true in the configuration call. This applies the setting to events sent from that page load.
gtag('config', 'G-XXXXXXXXXX', {
'debug_mode': true
});Replace G-XXXXXXXXXX with your measurement ID. Use this setting only in your development or testing setup. Do not add it permanently to production code unless you intentionally want all production events classified as developer traffic.
You can also set debug_mode on an individual event when only one test action should enter DebugView.
gtag('event', 'test_purchase', {
'value': 19.99,
'currency': 'USD',
'debug_mode': true
});If you use Google Tag Manager, configure the Google tag or the relevant event tag to send the debug_mode parameter. Keep the development configuration separate from the production configuration so test settings cannot accidentally reach every visitor.
Create and test the data filter
In the GA4 property:
- Open Admin.
- Select Data collection and modification, then Data filters.
- Create a new filter and choose Developer traffic.
- Give the filter a clear name, such as
Exclude development testing. - Set the initial state to Testing.
- Save the filter.
A filter in Testing does not remove data. Instead, GA4 adds the Test data filter name dimension to matching events. Use that dimension in an exploration or report to check whether the expected events match the filter.
When the test results are correct, edit the filter and change its state to Active. Active filters permanently exclude matching incoming data from standard reporting. They do not change events that GA4 has already processed.
| Filter state | Effect on incoming developer events |
|---|---|
| Testing | Events remain available and receive a test filter name |
| Active | Events are excluded from standard reporting |
| Inactive | The filter does not operate |
Verify the setup
Open the site with your development tag, perform a test action, and open Admin > Data display > DebugView. Confirm that the event appears and that its parameters include debug_mode with a value of 1 or an equivalent enabled value.
Next, check the Testing filter in an exploration. Add Test data filter name as a dimension and look for the name you assigned. If no events match, inspect the tag request in your browser's developer tools and confirm that debug_mode is actually being sent.
Exercise
You activated a developer traffic filter, but old test purchases still appear in historical reports. What should you do?
Show answer
Nothing can make the filter retroactively remove them. Filter the analysis by date or mark those historical test records separately, then verify that new events are excluded.