How We Removed Spam Referral Data from Google Analytics

Featured blog post image

Note: If you are RentVision client, this has already been fixed in your RentVision Platform information, so you may notice a change in visits, conversion rates, etc. If you have any questions, please contact your marketing advisor.

Bad news: spam doesn't only appear in your email or the comments section of your website anymore. Over the last several months, spammers have taken an entirely new tactic of "marketing": spamming your Google Analytics accounts to inject spam referral data.

Google Analytics is the gold standard tool for tracking what happens on your website, including who is visiting your website and how they found your site. If you don't have Google Analytics installed on your own, stop reading this article right now and follow this tutorial for installing Google Analytics on your website.

Two of the most helpful reports in Google Analytics are the Source/Medium report and the Referrals Report, which you can find under the "Acquisition" section of your reports on the left-hand side of Google Analytics:


Spam Google Analytics Referrals

These reports give you fantastic insights into where the traffic to your website is coming from. The problem is that spam referrers have begun to exploit this by pretending to send your website visitors, when in reality they are "advertising" to you to try to get you to their website—either to sell scam SEO services, or to inject viruses and malware onto your computer. We had one client who had received over 400 such referral visits over the last 30 days:


At best, this data is incredibly annoying, since it skews your analytics, and makes it difficult to figure out what people actually are doing on your website. These spam referrers spike your bounce rate and they slash your average time on site, giving you bad information to go off of when you are trying to use your analytics to make marketing decisions.

But here's the good news: it's not only possible to find these spam referrers, but also to eliminate them from your reports.

How to Find and Block Spam Referrals

There are two major ways that referrer spammers work. One is by actively crawling your site, in the exact same way that Google crawls your website. Using software that visits website after website, those crawler bots pretend that they have been referred to your website by the spammy SEO service. So, when those visits show up in Google Analytics, your curiosity drives you to visit sites like to find out what SEO scam they might possibly offer to you. These referrers can be blocked from visiting your website at all through adjusting your web server configurations.

The second method, called ghost referrals, are a bit harder to stop, because ghost referrals don't actually visit your website at all. They simply use software to scroll through all the possible Google Analytics ID numbers, so web server configurations won't do you any good.

But this is actually their undoing, because since they don't know your actual website address, we can filter those ghost referrals out of Google Analytics completely through a Hostname exclusion. Here's how to find your ghost referrers:

First, open the Source/Medium report, click on "Secondary dimension", search for "Hostname", and select that option:


Your "Hostname" is the address of your website, so, when you open up the Hostname report, you will see that spam referrers either use no hostname "(not set)" or they provide the incorrect hostname. You will also see that the crawler spam referrers do use the correct hostname (that is, your actual website domain name), since they actually visited your website:


How to Filter Bad Referrers from Google Analytics

Again, by adjusting your web server configurations, you will block the crawler referrals. But, that will only block those referrers moving forward, and your server configuration settings are powerless to block the ghost referrers.

So, to get that bad data out of Google Analytics, we have to create filters that can sift out that data. In Google Analytics, there are two types of filters:

  1. View Filter—this blocks the data from entering your Google Analytics account at all by creating a filter at the View level. Be careful with this filter, as there is no way of restoring data that you accidentally exclude.
  2. Segment Filter—this allows you to sift through the data within your Google Analytics account. This is safer, as you won't accidentally lose any information.

I will show you how to set up a segment filter, but you can also click the links below to download segment templates.

From within your Source/Medium report, click "+ Add Segment" from the top:


Then, select "+ New Segment":


Select "Conditions" from the left-side menu, and then add two conditions:

Hostname --> does not exactly match --> YOUR WEBSITE

Source --> matches regex --> darodar\.|semalt\.|buttons-for-website|blackhatworth|ilovevitaly|prodvigator|cenokos\.|ranksonic\.|adcash\.|simple-share-buttons\.|social-buttons\.|best-seo-|buttons-fo

(Source regular expression customized from this article.)


To make this easy, I have created templates that you can download and install—you just need to update the hostname to match your website:

The first segment filter will remove all the bad referrers from Google Analytics, but the second segment filter will let you only see the bad referrals to make sure that you aren't excluding things that you shouldn't.

Credit: I learned most of this information from the article, "The Definitive Guide to Removing Referral Spam." If you'd like to learn more about the technicalities of spam referrals in Google Analytics, I'd highly recommend this article.


Download Free Ebook

RentVision white outline of icon

Who We Are

RentVision enables you to generate more qualified traffic when you have a sudden increase in vacancy, and saves you marketing dollars when it’s under control.

Our articles are free to share! To learn more about sharing with your association or company, see our Citation Guidelines.