Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Ghost spam in GA4 via Measurement Protocol: how to stop it

TRK-350Low impactOther toolBy FunnelGuardPublished Updated
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.

Conversion rate with and without ghost sessionsExample numbers
Conversion rate with and without ghost sessions (example)Real data: 2 %; With ghost spam: 1.3 %01221.3Real dataWith ghost spam%

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

Look for ghost hits in GA4
  1. 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.

  2. 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.

  3. 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.

  4. Check event names

    In Reports, Engagement, Events, look for event names your site never sends.

  5. Check country and device

    Sudden spikes from one country, with (not set) device or browser details, point to spam.

Signs of ghost spam versus real traffic
SignalGhost spamReal visitor
Hostname(not set) or foreign domainYour domain
Page title(not set) or odd textYour page titles
Engagement timeZeroVaries
Event namesOnes you never set upOnes 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.

Contain the damage
  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Where to apply the hostname filter
  1. 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.

  2. Stop sending from staging

    Use separate GTM environments or a separate property so staging data does not look like foreign hostnames.

How to confirm it's fixed

Confirmation checklist
  • 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.

How ghost spam usually unfolds
  1. Day 1

    Spammers send hits to guessed Measurement IDs.

  2. Day 2

    Unknown sources and (not set) hostnames appear in reports.

  3. Day 7

    You spot them in a hostname exploration and save a filter.

  4. 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.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.