How Do I Block Google Analytics Spam?

young female fashion blogger showing off a colorful plaid shirt to a video camera

Google Analytics referral spam is a confusing, common issue for publishers. Fortunately, it is both harmless and simple to remove.

This is not real traffic, despite what the reporting says, nor is it anything to worry about. Your site is not being hacked or compromised.

A woman types at a laptop computer. Beside her is a phone, tablet, office supplies and data charts.

Spammers are not visiting your site, nor attempting to access it.

Rather, their goal is to send fake pageviews directly to your Google Analytics to get your attention and induce panic, and/or to mask or inflate their own traffic numbers, hoping you won’t notice.

In any event, your ads are not loading and no one is visiting your page. However, we still recommend setting up a filter to block this.

Your ads and earnings will not be affected, but your reporting will; RPMs will appear lower, as Google Analytics is counting artificial pageviews with no ad impressions to show for them.

How Do I Block Google Analytics Referral Spam?

1. Select Admin (the gear icon) on the left menu bar, then select All Filters in the lefthand property.

A screen capture of the Google Analytics admin portal, highlighting the All Filters section in the left column.

2. Click the Add Filter button.

A screen capture of the Google Analytics admin portal, showing an empty filters page.

3. Give your filter a name.

Anything, for your reference.

4. Select Custom under filter type.

5. Select Exclude (default).

6. Under Filter Field, select Referral.

This is the most common category in which fake traffic appears in Google Analytics. You can also filter by geographic location, page title and other options.

7. Under Filter Pattern, enter the URL in question.

e.g. lifehacĸer (dot) com, although this is only example! Copy exactly what appears in your analytics. 

A screen capture of the Google Analytics admin portal, showing a detailed view of adding a filter.

8. Under Apply Filter to Views, select any website(s).

This may be applicable if you have multiple affected sites under the same Google Analytics account. Add each of them in as seen here:

A screen capture of the Google Analytics admin portal, showing how to add and remove multiple filters to a search.

9. Save and watch the fake traffic disappear, usually within hours.

It should be as simple as that, but by definition, spammers are transient and extremely adaptable, and as a result, challenging to keep up with.

Further reading

There are different strategies aimed at stopping analytics spam being deployed all the time. Follow this link for another approach on blocking ghost referrals from different hostnames.

Related Posts

using a computer CLS: Solving for Cumulative Layout Shift

CLS: Solving for Cumulative Layout Shift

6 min read
eric hochberger

Cumulative Layout Shift is a pagespeed metric of Google’s Core Web Vitals. In today’s post, learn how to solve for CLS to make your pages faster. The announcement of Google’s …

Read More