Some of the content from this post was inspired by the article “Definitive Guide to Removing Google Analytics Spam” by Mike Sullivan.
It started out simple enough with semalt and buttons-for-websites. Then the ilovevitaly attacks began. Pretty soon Ranksonic began mocking us with fake events and organic search terms. Before we knew it there was a full-frontal assault of fake referral spam masquerading as legitimate website visitors compromising the accuracy of our Google Analytics reports. We all knew Google was working on it, a definitive solution just never came.
The problem was, and still is, most marketers don’t know what referral spam is, how to spot it, or how to remove it. This presents a major problem when businesses and marketers begin using these inaccurate Google Analytics reports to make conversion rate optimization decisions on A/B tests, landing page optimization, and more.
Worse yet, many marketers are unknowingly presenting traffic numbers to bosses and stakeholders that could be off by up to 60%!
Thankfully, there are a few proven strategies to eliminate Google Analytics referral spam. In this article we’ll discuss what referral spam is, how to identify it in your reports, and I’ll show you a few tried and true methods to clean up historical reports and prevent referral spam from effecting reports in the future.
What Is Referral Spam?
The majority of referral spam never actually visits your website which is why some marketers refer to it as “Ghost” spam. Even though this traffic never visits your website it still appears in your reports as legitimate traffic affecting total sessions, bounce rate, time on site, conversion rates and more.
On a major website where hundreds of thousands of sessions are recorded on a daily basis this traffic isn’t a major concern. On small business websites, this traffic can account for over 60% of daily sessions which causes major problems in month-to-month reporting, A/B testing, or other conversion rate optimization tests.
If this traffic never visits your website, why does it show up in Google Analytics? Google provides a developer tool called the Measurement Protocol. Among other legitimate uses, this allows developers and businesses to track behavior of their customers from a wide variety of different offline data sources and send that raw data to their Google Analytics account.
Unfortunately, this also opens the door for crafty spammers to force raw data into Analytics accounts by randomly attacking UA tracking codes, completely bypassing the website.
How Do I Identify Referral Spam?
There are a lot of ways to identify referral spam but the quickest is to review your traffic reports by clicking Acquisition > All Traffic > Source/Medium.
If the referring domain URL isn’t a big enough giveaway of the traffic source being spam, simply visiting the URL should remove all doubt.
Though some of these spammers have gotten more sophisticated, looking at % New Sessions, Bounce Rate and Pages/Session metrics are also a good indication. These metrics will usually be 100%, 100% and 1.00 respectively, another sign that this traffic never visits the website.
How Do I Remove Fake Traffic From Google Analytics?
Let’s be honest, there are thousands of blogs on this topic. Many are out of date, a lot include workarounds that simply don’t work, and others only eliminate some of the spam. What I’m going to outline below will work 100% of the time on new and old accounts. The only catch is you will need to update these filters as new spam domains continue pop up. Unfortunately, until Google provides a solution, there is no permanent “set and forget” fix for this.
Let’s get started.
My first recommendation, and I strongly recommend this, is to create a copy of your existing view. This copied view will remain untouched and unfiltered. This is a good safety net in case one of your filters begins filtering out legitimate website traffic.
To copy your primary view, click the Admin tab, select the view you’d like to copy and click Copy View.
The first three filters we’re going to add will block all future traffic from domains which are currently known to send referral spam.
To add our first filter click the Admin tab, select your Filtered View, click Filters, and enter a name for your filter keeping in mind there will be several.
Now this step is very important. You must select Exclude and choose Campaign Source. Many people fail to choose Campaign Source and can’t figure out why their filters aren’t working.
In the Filter Pattern field, copy and paste the string below:
Since there is a character limit to the Filter Pattern field, we need to create a second filter the same as the first, except in the Filter Pattern field paste:
… and a third filter like the previous two using:
The fourth and final filter we are going to create is a Hostname Filter. I mentioned that the far majority of this traffic never actually visits your website, thus, it never requests your actual hostname which is the URL used to reach your website (typically your domain name).
This can be seen in your Network report by clicking Audience > Technology > Network and selecting the Hostname tab.
Any traffic in the above screenshot that is not visiting my actual URL is spam. Almost 60% of all traffic! The Hostname Filter eliminates this spam from your reports by including only the traffic that reaches your website by requesting your actual domain name.
You create this filter much like the previous three. The difference here is you must select Include, choose Hostname for the Filter Field and enter your hostname in the Filter Pattern.
Congratulations! These four filters have just eliminated 99.9% of all referral spam from your future reports! Routinely adding new domains to the referral spam filters will keep this traffic under control and keep your future reports clean.
How Do I Clean Old Google Analytics Reports?
While the above mentioned filters will only fight future referral spam, you can still remove spam from historical reports using a single Custom Segment.
You can create a Custom Segment from any report, but I’d recommend going to Acquisition > All Traffic > Source/Medium. Once there, click + Add Segment > + New Segment.
Essentially we’re just going to recreate the four filters we created above, but as a single Custom Segment.
Click Conditions, and on the first filter select Hostname > Matches Regex and enter the hostname(s) you used in your fourth filter above.
Now we want to click the + Add Filter button.
Custom Segment filters default to ‘Include’, but it is very important that your second set of filters be changed to ‘Exclude’.
In the set of drop downs select Source > Matches Regex and paste the same list of spam domains from the first filter you created. Click the OR button and repeat this filter two more times with the respective list of spam domains.
If the Custom Segment you created matches the screenshot above you’ll notice the circular graph to the right reflect a smaller amount of traffic. This is the amount of site traffic that remains after all referral spam has been removed.
Once you save this filter, you can apply it to any report and any time frame.
Taking The Fight To The Spammers
Nothing can compromise an otherwise successful A/B test quite like inaccurate reporting. With these four filters created and your Custom Segment applied, you can ensure that the data you are basing important marketing decisions on is truly accurate.
Until Google releases a definitive solution to referral spam, bookmark this article and reference this as the most accurate and up-to-date guide on how to finally remove Google Analytics referral spam from your marketing reports.
About the Author: Dallas McLaughlin is a Digital Marketing Specialist at The James Agency, a full service advertising agency in Phoenix, Arizona. He blogs frequently at DallasMcLaughlin.com about Search Engine Optimization, Pay-Per-Click, and Social Media Marketing trends. If you have any questions, you can tweet him directly at @BossDJay.