Remove Ghost (Spam) Traffic From Google Analytics

It is a common problem among site owners these days that Google Analytics don’t filter by default unwanted traffic coming from sites like,,, … and the list can continue, probably making it a very long one. The reason they don’t filter (although it is a option you can check when creating a view for a property with the title “Bot Filtering” and description “Exclude all hits from known bots and spiders”, but it seems don’t affect traffic from these unwanted sources) is probably because some will like to have that traffic included in their reports.

Personally I don’t know what these sites are doing, whether they are doing something useful (like crawling for indexing purposes) or just spamming for traffic gain (some are saying, and I tend to agree with them, that they don’t even touch your site, just pick random Analytics id values and score on it), it is beyond my area of interest for the moment, I just want a way to clean my analytics reports from the data they insert into.

I was searching the Internet for a satisfactory solution and I found only one … and although undocumented I think it is a very elegant one. I will try to explain how to use it from scratch. Besides that I had discovered another one by myself, just as much as elegant as the first one.

Mainly, there are two ways of getting rid of unwanted traffic in your reports, and the solutions that I will describe below are each in one of these two categories. The first method is to create a segment and the second one is to create a filter for the report you are viewing. The traditional way in which the second method is usually implemented involves only filtering of future traffic, and must be used with very much care because the traffic which is excluded is lost forever. What I propose is use of a custom report which allows temporary exclusion of traffic from any host with effect for both past and future reports.

Using a segment for traffic exclusion involves creation of a segment for a certain view and attaching it to the report you are displaying. To create a segment, go to “Admin” menu, then select the desired account, the desired property and the desired view. In the “View” tab, in the menu well below, you will find the “Segments” option. Open it and it will show you two options … one button to create a “New Segment” from scratch and a link to “Import from Gallery” a certain segment (already created and shared to the world by dedicated users like you) at your choice.

For the beginning, let’s use the second option and look for the segment that I’ve found and whose name is “Filter out Semalt, and other spam referrers” by moorewebx. You can look for this segment template either checking “Acquisition” option from “Filter by category” menu or searching by the name in the search form above in the window. Once you find it click “Import” and the segment will be available for your use. It will be available in your Segments Gallery under the name “Remove Spam Bot Referrers”.

Looking closer to the segment you just imported you will realize that is relative easy to create a brand new, similar one from scratch. You just need to hit the “New Segment” button for creating a new segment, then in the newly opened window go to “Advanced” menu and select “Conditions” options. Then hit “Add Filter” button and add one by one the sites whose originating traffic you want to be removed from your reports. As an example for traffic originating from, hit “Add Filter” then from “Filter” option select “Sessions” and “Exclude“. After that from the drop-down list below select “Acquisition” and then “Source” options. Then in the following drop-down list select “contains” operator. In the text input field write semalt (without .com) and that is. Do the same sequence of operations for every host you want originating traffic to be removed from your reports. At the end don’t forget to give the segment a name and save it.

Subsequently, to use this segment (aka being applied to your reports), go to “Reporting” tab and instead of the default “All sessions” segment attached to each view please select “Remove Spam Bot Referrers” segment, or add it in combination with other segments, at your will. You will have a clean, not annoying report.

Second method involves using a Custom Report creation. In the default “Reporting” administration panel there is no helping option for the matter that concerns us … adding filters to exclude traffic originating from certain sources.

To create a custom report, go to “Customization” tab from the main menu, then hit “New Custom Report“. In the newly opened window I usually add one group with “Users“, ““, “Pageviews” and “Avg. Session Duration” metrics in the “Metric Groups“. Just below in “Dimensions” tab I use “Date” as the only selection.

What we are interested in comes below in the next row … “Filters – optional“. Hit “Add filter“, then select “Exclude” option, then “Acquisition“, then “Source“. From operator drop-down list select “Regex” and in the input text field write the name of the host you want to be excluded from your traffic report. To be consistent with our previous example let’s write semalt ( Repeat this sequence of operations for every host you want originating traffic to be removed from your reports. At the end give a suggestive name to your report and save it. Your report will be now a new clean one.

As a final word I need to say that these templates (both segments and filters) need to be updated as new unwanted originating traffic sites appear.