GA4 tracks events based on wherever your measurement ID fires — not based on whether the visitor is a real user or a developer running tests. Unless you explicitly tell GA4 to ignore traffic from staging, dev, and localhost environments, all of that non-user activity flows directly into your production data.

The result is a property that looks healthier than it is. More sessions, lower conversion rates, distorted engagement metrics, and reports that mix internal activity with real user behaviour. For properties that deploy frequently or have active development teams, this problem compounds quickly.

How to detect staging traffic in your property

The fastest way to check is to look at your hostname data in GA4. Go to Reports → Tech → Tech Overview, then change the primary dimension to Hostname. If you see anything other than your production domain — anything resembling staging.yoursite.com, dev.yoursite.com, localhost, or an IP address — staging traffic is in your data.

The severity depends on volume. A development team actively working on a redesign or running automated tests can contribute hundreds or thousands of sessions per week. We regularly find properties where 5–25% of all sessions originate from non-production hostnames.

What to look for in your hostname report: Any hostname that isn't your live production domain is suspect. Common patterns include staging., dev., test., uat., local., localhost, numeric IP addresses, and Vercel, Netlify, or Heroku preview URLs from your deployment pipeline.

The real impact on your metrics

Staging traffic doesn't just add noise — it systematically distorts specific metrics in predictable ways:

MetricWith staging trafficProduction only
Sessions (monthly)48,20041,000
Conversion rate1.4%2.1%
Engagement rate51%64%

How to filter staging traffic out of GA4

Method 1: Hostname filter via Data Stream settings (recommended)

This is the cleanest approach and requires no changes to your tag or GTM setup.

  1. Go to Admin → Data Streams and select your web stream
  2. Click Configure tag settings
  3. Under Manage unwanted referrals, add all non-production hostnames you want to exclude
  4. Alternatively, scroll to List unwanted referrals and add your staging domains

Note: This method prevents staging domains from creating new sessions but does not filter all event data. For complete exclusion, use Method 2.

Method 2: GTM trigger condition (most complete)

In Google Tag Manager, add a trigger exception to your GA4 Configuration tag. Create a trigger that fires when Page Hostname does not contain your production domain, then add this as an exception to the GA4 tag. This prevents the tag from firing at all on non-production environments.

  1. In GTM, go to Triggers → New
  2. Create a trigger of type Page View
  3. Set the condition to fire when Page Hostname does not contain yourproductiondomain.com
  4. Name it something clear like "Staging/Dev environments"
  5. Open your GA4 Configuration tag and add this trigger as an Exception

Method 3: Conditional tag firing via code

If you load your GA4 tag via code rather than GTM, wrap the initialisation in a hostname check: only initialise the GA4 tag when window.location.hostname matches your production domain. This is the most reliable method for development teams who want to guarantee no staging data ever reaches GA4.

Apply it to all environments. Don't just filter your primary staging domain. Check for all non-production environments: CI/CD preview URLs, QA environments, UAT instances, and any localhost development. Each one is a potential source of contamination.

What about historical contaminated data?

Once staging traffic has been recorded in GA4, it cannot be retroactively removed. There is no delete or filter function that cleans historical event data in GA4. This is why identifying and fixing the issue as early as possible matters — every day the filter isn't in place, more contaminated data accumulates permanently.

For historical analysis on a property where staging traffic has been present, the most practical approach is to create an Exploration in GA4 filtered to your production hostname only. This gives you a clean view of historical data without the contamination, even though the underlying data still includes the staging sessions.

Check your hostname health automatically

GA4 Health Check's automated audit scans your session data for non-production hostnames, quantifies what percentage of your traffic they represent, and flags the finding in your report with remediation steps. It takes 60 seconds and surfaces problems that would take hours to find manually across a full property audit.

Run a GA4 audit to check for staging traffic →

A property with 15% staging traffic has a 15% data quality problem. Every metric, every report, and every decision made from that data is affected. The fix is straightforward. The cost of leaving it is compounding. Run an automated audit →
Travis Gunn
Founder of GA4 Health Check. Working with Google Analytics since 2013, with over 250 clients audited across almost every industry vertical. 100% Job Success on Upwork for over a decade.