How to Remove Spam Referral Traffic from Facebook

Let's start

So recently I noticed that installing Facebook Pixel via Google Tag Manager records spam traffic in ads manager. I didn’t notice this until I saw the purchase pixel. It was displaying 24 purchases in the last 7 days but there was no actual purchase in the backend.

How to view the referral URL in ads manager?

To make sure your pixel data is accurate and there is no spam referral, open your ads manager and navigate to pixels. Select the active pixel. Scroll down to see the graph and click on activity from the graph navigation menu.

 fb pixel activity analysis

In the activity tab, click any event or pageview pixel. I clicked on the add to cart pixel to see the referral URL.

 check referral url

If you look at the referral URL, it is not the website URL, instead, it belongs to GTM. The referral URL is

This is really annoying and I believe you have never looked at this data until you check the purchase pixel. Because we can imagine that ok, people are visiting my website and they perform certain activities.

How to block appspot referral in GTM?

Now, how do we actually solve this issue? There is not a big thing to do, you only have to add a javascript code which will prevent the pixel code to fire when the referral equals to the appspot URL.

You will have to add the below line of code to every pixel(base + event) you have added via GTM.


pixel code here


Below is an example of how base and event pixel will be modified.

Base Pixel:


fbq('init', xxxxxxxxxxxxxxx); // Insert your pixel ID here.
fbq('track', 'PageView');
<noscript><img height="1" width="1" style="display:none"

Event code:

        content_type: 'product',
        currency: 'Rand'

Once you add this to all pixels, you will never have to see any referral traffic in ads manager and your data will be accurate. If you have questions regarding this topic, please ask us directly on Twitter.

Don't miss out when new resources launch

Our customer analytics experts share wisdom only once a month

Share now
We are customer-analytics consultancy that transforms messy data into actionable insights that will help you grow your company and make better data-backed decisions.