Stop refereer spam

When I looked at Google Analytics, the site's traffic suddenly surged. The main indicator did not increase, but it was strange, so I looked at the referrer.


Traffic from has increased dramatically. Upon entering, you will be redirected to

Ah! This is so-called referrer spam. Referrer spam informs where my site has been referred and redirects to another site to promote the site.

When the http protocol requests a document, it also requests the location of the current document, and the web server records it in the log. Google Analytics, such as a website analysis tool, analyzes this as a reference site, and uses this principle to send spam to the referrer. This guy's marketing makes good use of technology as well.

After the creation of the Internet, so-called spam mail, which is an offline advertising letter, appeared on the Internet as it is. It wasn't until several decades later that a law was passed that required prior consent in each country. However, such spam traffic is not yet regulated. Search engines crawl around the site, there is only etiquette of robot. Regulating search engine crawling and revenue from portals and search engines are also old issues.

Traffic through this spam wrapper not only prevents administrators from seeing the traffic properly, but also places a load on the web server.

Web hosting usually pays for hard capacity and traffic capacity, so if spam traffic runs out of traffic for my normal users, or if it's not a pay-as-you-go system, it may cost more.

So I did two things:

  • How to disable spam referrer filter in google analytics
  • Block access to the web server


Filtering Spam Referrers in Google Analytics

Google Analytics allows you to filter. However, it does not apply to existing data, but only to new traffic. It's really inconvenient because it's not retroactive.


Exclude by domain name

Here's how.


  1. In the Google Analytics admin menu, tap the filter for the view.
  2. Create a filter by clicking 'Add Filter' in the filter list
  3. As in the following screen, set the flutter type to custom and enter the name from the referrer in the campaign source.


You can create one filter at a time, but there is a limit to the number of filters you can create. So you can still add it to your filter pattern in the form of a regular expression.





Exclude by IP

It can also be blocked by IP. Similarly, multiple IPs can be entered.



Block IP from entering the web server

If you cheat a user agent like a search engine, you can also do it in robots.txt, but this is referrer spam, so you can block ip.

When I ping, the IP is I don't know when it will change, but I stopped it for now.

blocking with .htaccess

Open the .htaccess file in your directory, create it if it doesn't exist and add the following:


Order Allow, Deny
Allow from all

Deny from


If you do this, the sender cannot connect because the web server blocks it, so you can change the ip to enter. Well, with security, spears and shields, we have no choice but to respond to each other.

I learned this from a spam referrer from Russia after I installed Google Analytics on my company site before, and it still seems to work.


0 If you like the article, please click the heart~ It will be a strength to bloggers (SNS/login/advertising is not related)

Articles you might like

Health to Calendar

Import your Apple health records into your calendar events and view your health records chronologically on your calendar

Add a Comment

Email addresses are not disclosed. Required items *is indicated by

This posting is part of Coupang Partners' activities, and a certain amount of commission is provided accordingly.