How to filter out bot website traffic in Google Analytics

by | Jun 18, 2020 | Advanced, Analytics | 1 comment

Recently on of the Members in my free Facebook group Online Marketing Basics for Busy Website Owners, a member had asked a question about some weird traffic patterns seen in their Google Analytics account:

It’s called referrer spam and sometimes it doesn’t’ even visit your site (which is why you may see 0:00 seconds of time spent on your site), instead triggering the analytics tracking code to fire and record the visit.

The reason you get referral spam? Most likely so that you investigate the site link you can see the traffic coming from. More often than not it’s a online store that has affiliate links to Amazon or Ebay products.

I realised that although i had told them WHAT is is I could have shown them how to filter that traffic out from their reports so that they could get a better picture of the true behavior of visitors on their site.

So that’s what this post is all about: showing you how to filter out traffic from certain views in your Google Analytics reports.

How to Spot Referral Spam Data

First thing’s first – you actually have to find that you have a problem with bot traffic.

You should be checking your Google Analytics account on a regular basis and looking at the traffic graph over a set period of time on a monthly, if not weekly basis.

If there are any spikes in the graph, this could be spam (or you were just really popular that day!)

If you see something like this, then head to the Acquisition > All Traffic > Source/Medium report from with your Google Analytics admin and review the list of the source/medium traffic results.

If you see any links that you don’t recognise, or if they have “bot” or “free” in the URL name or end with a TLD you don’t recognise like .xyz then it’s most likely to be spam traffic.

Check the Avg. Session Duration and if the time spent on your site is a matter of seconds, then it’s extra confirmation that you have spam traffic coming to you site because the site recorded a visit but no one actually visited.

How to Filter It Out From Your Google Analytics Reports

To filter out traffic like this from your GA, you’ll need to head to: Acquisition > All Traffic > Channels

Head to the top of you page and select the ‘Source’ report underneath the ‘Secondary Dimension’ drop down option:

Once the table below has updated, head to the top of the page and select the ‘Add Segment’ option:

Then click the red +NEW SEGMENT button:

Then the ‘Conditions’ option that appears, search for Source in the field and then select:

In the second drop-down option, search and select the ‘matches regex’ option:

In the third box, add the following code (with thanks to


What you should see after you have added the code is the report box on the right hand side start to change and tell you how much traffic has been filtered out of the report:

Then click the blue save button.

This means you now have report that only shows the bot traffic:

To exclude the bot traffic go back into your newly created segment and change the filter as shown below to ‘exclude’:

…and then rename the report to ‘Ex. Bot Traffic’. You’ll see the figures on the right hand side change to now remove the bot traffic:

You can now apply this segment when you want to see a report that doesn’t include bot traffic!

I hope that this guide was useful! Let me know how you get on in the comments below!

1 Comment

  1. Marie Parton

    Thanks Vicki, that’s a super handy way to keep bots from my Google Analytics figures.


Submit a Comment

Your email address will not be published. Required fields are marked *