If you are a blogger like me and like to work with your Google Analytics, you might have sometimes noticed an unusual spike in traffic from some unknown source. You might be thinking about where they have come from, you may have also noticed in your Google Analytics that the bounce rate of all fake traffics is 100%. This is nothing but the referrer spam or Ghost Spam.
Google Analytics is the most reliable and powerful tracking tool to analyze the traffic data of any website, and these types of Ghost referrer spam might messing up with the actual web traffic stat. Also clicking on these spammy links may lead to any malicious sites.
What is Referrer Spam
A referrer is just a simple HTTP header that is passed along when a browser goes from one page to another page and is normally used to indicate where the user is coming from.
A referrer Spam is a fake referrer URL or spammer who has a website which they want to boost rank in Search Engine. This spammer sends out multiple requests with fake URLs that link back to the website they want to rank with access log. The affected sites that publish their access logs, including referrer statistics, will then unknowingly link back to the spammer’s site. These links will be indexed by search engines like Google as they crawl the access logs and ultimately improve the spammer’s search engine ranking and website’s visibility. Thereby, you are unknowingly linking your website to any low-quality website and help these spammer websites to improve their ranking.
In General, they are two types spammers
1. Crawler or bots
These are not bad at all, mainly sends out by the search engine like Google or Bing to index your page URL. The bots or Crawlers will not hide their identity and these visits will not reflect in the Google Analytics report.
2. Spammers or Ghost Referrer
These referrals can really harm your analytics reports. Spammers will send fake traffic to Google Analytics, without even accessing your site. But spammers’ URLs will appear in your Google Analytics statistics, and also induce the site owner to visit the spam URLs. While the spammer will never visit your site, these kinds of fake visits are also known as Ghost Spam or Ghost Referrer.
You can not track the actual source of referrer spam that is where they are coming from, they will always musk their actual URL. Not only that, sometimes these ghost spams may leave any malicious links and click these links may risk you losing your data or sometimes even your website. Also, these spammers will waste lots of your server’s bandwidth.
How to remove Referrer spam in WordPress
So, how could we get rid of these referrer spam from WordPress Website? There are three simple methods, which can remove referrer spam from WordPress sites.
# Method One: By Using WordPress Plugins
If you running your site on WordPress, then you have tons of options to customize your blog. WordPress is a very popular CMS with a huge directory of Plugins, which you can use to customize your blog. By using Plugins, you can remove referrer spam from your WordPress site.
As the name suggests Bot Block can remove Referral Spam from your WordPress Site. Install the plugin from the WordPress Plugin directory. This Plugin is specially designed to stop the referrers spam to reach your site.
After installing the plugin, go to settings, you will see the option like this
You can add more custom domains to block in the database.
This another WordPress Plugin which you can use to block referral spam in your WordPress site. This plugin uses a blacklist to filter your incoming traffic and block “spam referrer” attacks.
Download the plugin from here.
# Method Two: By rewriting .htaccess rules to block referrer spam.
Alternatively, you can edit your .htaccess rule to block Ghost referrer spam, but make sure to take back up of your .htaccess file.
Use the following code
##STOP REFERRER SPAM RewriteCond %{HTTP_REFERER} example\.com [NC,OR] RewriteRule .* – [F]
Copy the code above, replace the example.com with your referrer spam. If your more than one referrer site, then you can add more custom domains, like if you add example.net or example.org, then your Rewrite rule will be
## STOP REFERRER SPAM RewriteCond %{HTTP_REFERER} example\.com [NC,OR] RewriteCond %{HTTP_REFERER} example\.net [NC,OR] RewriteCond %{HTTP_REFERER} example\.org [NC,OR] RewriteRule .* – [F]
Alternatively, if you know the spammers or Ghost referrers sites, you can generate the code by using this tool. Copy the generated code and paste it into the .htaccess file.
How to edit the .htaccess file in the WordPress Site?
Method # 1
If you have already installed the Yoast SEO plugin, then Go To the under noted navigation.
SEO>Tools>File Editor> Edit .htaccess file.
Method # 2
Alternatively, you can directly edit the .htaccess file from the file manager in your WordPress Cpanel. If you use SiteGround hosting, then you can access the .htaccess file by Cpanel Home>FileManager>Documents Root
Don’t forget to tick the Show Hidden Files (dotfiles) option, as .htaccess file mostly hidden in the root folder by default. Just Paste the code at the bottom of the .htaccess file and save.
If you can edit the .htaccess file, then this is the best method to remove referrer spam from your WordPress site.
#Method Three: By Using filters to remove referral spam
Despite, implementing the above two methods, you may notice some unknown referrer spams in your Google Analytics. As I have said earlier, the Ghost referrers are not visiting your site, therefore, sometimes it is not possible to block them totally by editing .htaccess file.
To remove referrer spam, we have to make Hostname inclusion filter in Google Analytic menu. Here’s the complete process
Login to your Google Analytic Dashboard, the Go To ADMIN> AUDIENCE> TECHNOLOGY> NETWORK
You will have to select the option Hostname as Primary Dimension and expand the result as monthly.
After selecting, Hostname, you will see the list of spammers name in that list.
You need to note down all the valid Hostnames which you want to include.
Now, you have to filter the valid Hostnames in Google Analytics filter option. For doing that return to Admin and select the filter option, then click Add New Filter to add filter screen.
Next, on the filter screen, add a Filter Name, select Custom option as a filter type. Click on include and chose Hostname as Filter Field. The reason for choosing the “include” option as opposed to Exclude option, because we do not have to constantly update the spammers’ Hostname in Google Analytic filter as Valid Hostname will filter out all the Ghost referrers.
Next, we have to fill up the valid Hostname. Here the format is in Regex pattern, you have to add a ^ sign before each hostname and a $ sign after it. Use | sign to separate hostnames. For example ^yoursite.com$|^example.yoursite.com$|. Do not add space between the Hostname.
After that click the save button to save your Google Analytic valid Hostname filter.
Now, verify the filter view after the next few weeks to make sure if your Filter reporting is working properly or not.
By following the above three methods, you can remove referrer spam from your WordPress site. If you like the article, then don’t forget to add your comment below.
To access all the latest posts directly to your email, please subscribe us here.
Read More…