On this page
What this issue is
The Measurement Protocol is a Google API that lets servers send events to GA4 without a browser. Spammers guess or scrape Measurement IDs (they look like G-XXXXXXXXXX and are visible in any page source). They then send fake hits to random properties. Those hits show up as sessions from strange sources, fake page paths or made-up events.
Why it costs you leads or sales
The direct cost is usually low. Ghost spam does not take real leads. The damage is to decisions: inflated sessions, wrong conversion rates, fake events that look like conversions, and noisy source reports. If you mark a spam event as a key event, or import it to Google Ads, it can distort bidding.
Example: 100 real conversions from 5,000 real sessions is 2.0%. If 3,000 ghost sessions are added, the reported rate drops to 1.25%.
How to check if your site has it
Open a hostname report
In Reports, Explore, create a free-form exploration. Add the dimension Hostname and the metric Sessions. Real traffic shows your domain. Ghost hits often show (not set) or a domain that is not yours.
Check page paths and titles
Add Page path and Page title. Spam often has (not set) titles or paths that do not exist on your site.
Review sources
In Reports, Acquisition, Traffic acquisition, look for unknown sources, promotional wording in the source name, or one-session spikes with 0 seconds of engagement.
Check event names
In Reports, Engagement, Events, look for event names your site never sends.
Check country and device
Sudden spikes from one country, with (not set) device or browser details, point to spam.
| Signal | Ghost spam | Real visitor |
|---|---|---|
| Hostname | (not set) or foreign domain | Your domain |
| Page title | (not set) or odd text | Your page titles |
| Engagement time | Zero | Varies |
| Event names | Ones you never set up | Ones your tags send |
How to fix it
You cannot block ghost hits at the source, because they go to Google and not to your server. You can keep them out of your analysis. GA4 has no way to delete the hits already stored, so the work is filtering and keeping them from affecting conversions.
Filter reports by hostname
In explorations and reports, add a comparison or filter where Hostname contains your domain. Save it as a comparison so you can reuse it.
Create an audience or segment
Build a segment of sessions with your hostname and use it in Explorations. In Admin, Audiences, you can build one from the hostname dimension for use in Google Ads.
Check your key events
In Admin, Events, make sure only real conversion events are marked as key events. Do not mark generic event names that spam could copy.
Review Google Ads imports
In Google Ads, Goals, Conversions, check that imported GA4 conversions are real ones and that the counts match real orders or leads.
Use data filters for internal or developer traffic
In Admin, Data settings, Data filters, you can filter internal and developer traffic. These filters do not target arbitrary spam, so use them only for your own traffic.
Consider a new property if it is severe
If a property is heavily polluted, create a new GA4 property with a new Measurement ID and install it. Keep the old one for history. Spammers can find the new ID too, so it is a reset and not a lasting block.
Keep the Measurement ID in the config tag only
Use one Google tag with your ID. Do not paste it into extra places, such as public docs or shared code samples.
Stop sending from staging
Use separate GTM environments or a separate property so staging data does not look like foreign hostnames.
Check plugins that add the ID
If a plugin such as a site-kit or analytics plugin and your theme both add the ID, remove one so you know where it is used.
Filter in GA4, not WordPress
WordPress cannot stop hits that never reach your server. Apply the hostname filter in GA4 reports.
Use a separate ID per environment
Load a different Measurement ID on staging and production so each property stays clean.
Do not use the API secret client-side
If you send server events through the Measurement Protocol, keep the API secret on the server only.
How to confirm it's fixed
- Your saved hostname comparison shows only your domain.
- Key events are only real conversion events.
- Google Ads conversion counts match real leads or orders.
- New spam hits, if any, do not appear in reports you use for decisions.
- Session counts are close to what your server logs or CRM suggest.
How to prevent it happening again
You cannot hide a Measurement ID, because it is public by design. You can lower the risk of damage. Review the hostname report each month. Keep key events tight. Never expose a Measurement Protocol API secret in frontend code, since that lets anyone send valid events.
Day 1
Spammers send hits to guessed Measurement IDs.
Day 2
Unknown sources and (not set) hostnames appear in reports.
Day 7
You spot them in a hostname exploration and save a filter.
Day 8
Decisions use filtered data again.
How FunnelGuard handles this
This issue is outside what FunnelGuard checks. Ghost spam never visits your site, so a robot that runs your customer journeys will not see it. The fitting kind of tool is a web analytics data-quality tool: GA4's own explorations and filters, or an analytics audit or reporting tool that flags anomalies in sources and hostnames.
Questions people ask
What is ghost spam in Google Analytics 4?
Ghost spam is fake traffic or events sent to your GA4 property through the Measurement Protocol using your Measurement ID. The sender never visits your site. It appears in reports as odd sources, (not set) hostnames or events you never created.
Why am I seeing traffic from strange sources in GA4?
It is likely referral or ghost spam. Spammers send hits to many Measurement IDs and use a promotional source name. Check the Hostname dimension in an exploration. If it is (not set) or not your domain, the hit is probably fake.
How do I remove ghost spam from GA4?
You cannot delete hits already stored. You can filter them out of analysis with a hostname comparison or segment in Explorations. Also make sure only real events are marked as key events so spam does not affect conversions.
Can I block Measurement Protocol spam at my server?
No. The hits go directly to Google servers, not to your website, so server rules, firewalls and IP blocks do not stop them. Filtering happens in GA4 reporting.
Does ghost spam hurt my Google Ads results?
It can if a spam event is marked as a key event and imported into Google Ads as a conversion. Check imported conversions against real orders or leads and remove any that look wrong.
Should I change my GA4 Measurement ID?
Only if the property is heavily polluted. A new property gives you a clean start, but the new ID is public too, so spam can return. Keep the old property for history.
Does the Measurement Protocol API secret need to be hidden?
Yes. Keep it on the server only. If it is in frontend code, anyone can send valid events to your property.
Can FunnelGuard detect ghost spam in GA4?
No. It is outside what FunnelGuard checks, because ghost hits never touch your site. An analytics data-quality or audit tool fits better.
Related issues
- TRK-345Bot/spam traffic inflating sessionsFix guide
- TRK-351Measurement Protocol API secret exposed in frontendFix guide
- TRK-349Events from localhost or staging domains in production propertyFix guide
- TRK-346Spam form submissions firing lead conversionsFix guide
- TRK-347Own staff visits counted (no IP/internal filter)Fix guide
- TRK-344Test orders/leads counted as real conversionsFix guide