Referrer Spam: What Is It and How to Block it?
Referrer spam
Learn what referrer spam is and how to block unwanted referral traffic and bots using your .htaccess file and in Google Analytics.
Links on this page
What is referrer spam?
Referrer spam is a form of spam indexing aimed at website analytics data that has been around for a few years. Referrer spam is designed to create repeated site requests using a referral URL of the website the spammer is promoting (or of a URL that will forward to the site they are promoting). The benefits that referral spammers have with this blackhat SEO tactic is that it will help them advertise the website they want people to visit and it will also improve the spammers search engine ranking by potentially creating backlinks.
Referrer spam is primarily designed to obtain new visitors and website traffic to the sites they are promoting. When a webmaster or website owner notices unusual referral traffic in their data they might become curious and visit the URL. The sites promoted by referrer spam usually have something to do with online marketing or services that website owners might find appealing.
Over the years, referrer spam indexing has become a big problem for many webmasters, website owners, and those who provide website services. It can ruin your website’s Google Analytics data and be hard to ignore. For example, a referrer spam site usually appears to visit one page on your site multiple times which will manufacture a 100% bounce rate. If you want to know how your site is performing, this can cause an issue. Referrer spam that employs bots and crawlers can be an even bigger problem because they can use bandwidth andc negatively affect your site’s performance.
How to make a campaign source exclude filter
Create an exclude filter if you do not wish to receive referral traffic in your Google Analytics data from specific URLs. To block a referral path use the Campaign Referral Path Exclude Filter below.
1. Open your Google Analytics account and go to the Admin tab > Click Filters on the right side in the VIEW section.
2. Click the + ADD FILTER button to create a new exclude filter.
3. Add something you can easily remember as the Filter Name such as “Referrer Spam Filter.”
4. Select the Custom Filter Type.
5. In Filter Field, find and select Campaign Source in the list. In the Filter Pattern text box, add the referrer spam URL you want to blcok and click the blue Save button on the bottom of the webpage. To add multiple URLs to the same filter you can make a Filter Pattern similar to this with a | between each URL: Example.com | Example.com
How to make a campaign referral path exclude filter
1. Open your Google Analytics account and go to the Admin tab > Click Filters on the right side in the VIEW section.
2. Click the + ADD FILTER button to create a new exclude filter.
3. Add something you can easily remember as the Filter Name such as “Referrer Spam Filter.”
4. Select the Custom Filter Type.
5. In Filter Field, find and select Campaign Referral Path in the list. In the Filter Pattern text box, add a partial string of the referrer spam URL that you want to block and click the blue Save button on the bottom of the webpage.
How to block referrer spam using .htaccess file
To block referrer spam at the source using your .htacess file edit the code below to block the specific URL you want to block and add the code to your .htaccess file. To block a specific referrer spam website replace example.com with the URL you want to block.
RewriteCond %{HTTP_REFERER} example.com [NC] RewriteCond %{HTTP_REFERER} example.com RewriteRule .* - [F]
Alternative .htaccess File
RewriteEngine On RewriteCond %{HTTP_REFERER} example\.com [NC] RewriteRule .* – [F]
How to filter language spam
Filter language spam in Google Analytics to get rid of spam using the language dimension.
1. Open your Google Analytics account and go to the Admin tab.
2. In the “View” column select Filters and then click + Add Filter.
3. Add a Filter Name: Language Spam (or something you can easily remember).
4. Go to: Filter Type > Custom > Exclude
5. Select Filter Field: Language settings
6. Add a Filter Pattern: \s[^s]*\s|.{15,}|\.|,
7. Click on the blue text that says Verify this filter to see a preview table of how this filter will work in your account. You should only see language spam on the left side of the table: filter-verification-language-spam
8. After you verify the filter click the Save button on the bottom of the page.
How to exclude hits from bots and spiders
Exclude all hits from known bots and spiders in Google Analytics to block bad-bot and spider traffic.
1. Open your Google Analytics account and go to the Admin tab
2. In the “View” section select the account you want to use or ensure that the account name is visible.
3. Click View Settings in the “View” section and scroll down to the Bot Filtering area.
4. In the Bot Filtering area check the box that says Exclude all hits from known bots and spiders and click the blue Save button below. This will block known bots in Google Analytics.
Ugh! Novice here struggling to understand instructions. I have a list of exclusions I need to put in place and I’m trying to understand which filter setting I choose.
For example, I followed the directions for compliance-brian.xyz article that you published. In that post, you say to chose Campaign Source. Was wondering why I wouldn’t choose Campaign Referral Target URL instead.
All my spam entries in analytics are to URLs like this one below which Google Analytics labels “Page Title.”
motherboard.vice.com/read/this-pro-trump-russian-is-spamming-google-analytics
I have one that is not a URL. It simple reads Vitaly Rules Google. Do I also select Campaign Source or should I choose something else?
Any help you or anyone else could throw my way would be most appreciated.