Skip to content

Filtering out google analytics referral spam

Photo of Daniel Zuccon

Daniel Zuccon

Co-Founder & Operations

Posted: 24 Mar 2020

Knowing your website stats is vital if you want to properly monitor the progress of your marketing efforts, and make informed data-influenced decisions. At Optimising, we are looking at analytics all the time for our clients, so we need to ensure we are getting the most accurate information possible.

You may have noticed a lot of 'referral spam' popping up in your Google Analytics data over the past few months. These are some of the worst offenders:

Referral Spam

This has become a growing problem and Google is yet to issue a solution themselves (even after being made aware of this problem in at least 2013).

Here's an example from one of our clients using a brand new domain! The referral spam is making up over 70% of their traffic!

Referral Spam Graph

But why?!

These spammers get your attention but posting their URLs in your Analytics data. You then visit their website to see what the hell it is!

But how?!

Google Analytics is a simple Javascript code that is placed a website. It has no authentication so anybody can actually post data to it from anywhere just by knowing your UA-ID (which is the public key that looks like 'UA-XXXXXXX-XX').

What not to do

A few of these spam services offer an 'opt out' link on their websites. I can confirm that this does not work! It's probably best not to even bring your website to their attention by submitting your site in this fashion.

So now what?

Your best method is to simply filter these out of your Google Analytics. I know some people would prefer to fix the problem at the source (myself included) and not even allow them to post to your Analytics at all, but you have no other option here.

Here is our simple method which works for majority of the spam, or at least enough not to skew your real data too much.

  1. Log in to your Google Analytics.
  2. Set the Date Range to the past 12 months (or so) to get a good amount of sample data.
  3. Go to Acquisition > All Traffic > Referrals
  4. Add a 'Secondary Dimension' for 'Hostname'
  5. Sort the table by 'Hostname'.
  6. In my example the only real one was: But read through your list carefully as to not miss CDN hostnames or similar.It is pretty safe to add these ones whilst you're at
  7. Go to Admin > View > Create new view (always do this so you don't ruin your master data source).
  8. Call it 'Excluding Spam' or similar.
  9. Set timezone accordingly.
  10. Go to Admin > Filters > New Filter (it should be applied to the 'Excluding Spam' View you just created).
  11. Call it 'Exclude Spam' with type 'Include' and 'Hostname'.
  12. Using your real hostnames from step #6, format them like so (with pipes between the hostnames, and escape the fullstops with backslashes):www\.optimising\.com\.au|translate\.googleusercontent\.com|webcache\.googleusercontent\.com|web\.archive\.org
  13. Click Verify this Filter and you should see the spam traffic that is going to be excluded.If there are any wrong ones in there go back to step #5.
  14. Click Save.
  15. Now when you view the Reporting use your newly created View.


Unfortunately this method will only work for data captured going forwards and your historic data is still going to be skewed. So the earlier you implement this, the better!

The only flaw with this method is if the (smarter) spammers use an actual hostname of yours then they will not be excluded. In which case you can set up a second filter to specifically exclude these referrals. But so far, we have found this to work ~90% of the time.

If you are serious about your website data, and you should be, start with the above so that you can start to trust your own numbers!

Photo of Daniel Zuccon

Daniel Zuccon

Co-Founder & Operations

With over 20 years experience in the industry, Daniel has produced an extensive number of web projects for some of Australia’s largest brands. His passion and interest for web development originated from building his first website in 1998 (in exchange for a skateboard, no less!) to running many successful boutique eCommerce stores and large online communities.

Since then, Daniel has made the leap of co-founding Optimising, the specialist SEO Agency that we know today. From its humble beginnings, the team has grown from a two-man enterprise to a large core team, growing into a highly respected digital agency.


We value purpose over profit and take action.

Our values and beliefs have always set the tone and approach to our business. It's not just enough to grow as a company and produce profits, we have a global responsibility to make our economy more inclusive and sustainable. As both a B Corp and a member of 1% for the planet, we have further cemented this purpose within our organisation.

However, our work isn't done quite yet. For Optimising, this is simple the start of our journey towards building a better business and world!

Partner with
the real deal

Chat with us today and we’ll get you the results you deserve.

Google Partner Premier 2022
Shopify plus partners
AWIA: Australian Web Industry Association
Aboriginal Flag
Torres Straight Flag

We acknowledge the Wurundjeri Woi Wurrung people as the Traditional Owners of the land now known as Richmond. We pay our respects to Elders from all nations - and to their Elders past, present and future.

Pride flag

Optimising is committed to cultivating and preserving a culture of inclusion and connectedness. We are able to grow and learn better together with a diverse team of employees.