If you’ve had your site for a while you’ll likely have experienced spam in your analytics. I know I have.
Even if you add filters to your site those only work moving forward. They don’t change anything retroactively.
So if you want to look at your historical data without spam we’ll have to use something other than filters. We're going to use segments.
Adding a Segment
To start we have to add a segment. I have one of my reports open and I can click on Add Segment.
Let’s give it a name. I’ll call it All Users (Not Spam).
Scroll down to Conditions.
Set Include to Exclude since we want to remove any traffic that's spam.
Exclude Spammy Languages
Click on the drop down and select Language.
Then for the middle drop down select matches regex – which stands for regular expression. We'll be using a regular expression to match spam.
In an earlier post I created a regular expression for language spam. You can see how I did it there or you can just copy and paste this:
Now we’re going to click OR that will let us add additional conditions.
Exclude Crawler Spam
Let’s check for crawler spam.
Select Source in the left drop down. And then matches regex again in the middle.
And then for the textbox copy and paste this in:
Credit: Carlos Escalera put together ^ the above list.
And then click OR.
Exclude Hostname Spam
Lastly let's get hostname spam.
Select Hostname in the left drop down. And then matches regex one more time.
And then in the text box use the hostname filter I created for an earlier post:
And then you can click Save.
Now you might not see a huge difference. So I recommend looking at the past year. I went through the past year and found the a three week period where they hit me pretty hard.
In addition, the spam made me think there were significant bumps. When in fact my traffic was pretty consistent this whole time.
I hope your analytics weren't hit as hard as mine were. It's very disappointing. And impossible to get rid of completely. Do put in place some filters if you haven't already.
And when you need to look at your historical data you can use this segment and you'll be fine. 🙂