How to Get Rid of Spam in your Analytics

The data from your Google analytics is extremely important. It helps you understand how well your site is performing, and it gives you guidance on how to improve your site, such as content that your visitors want or tweaks that need to be made to the design. You expect that the data you get from your Google analytics is trustworthy. After all, you’re getting the information straight from the source: The search giant that controls us all. Yet many marketers are becoming frustrated to find that their numbers are increasingly untrustworthy thanks to spam in their analytics.

Here’s what you need to know about the problem with spam in Google analytics and how to avoid it:

Types of Spam You’ll Encounter

The spam you’ll find in your Google analytics will either be from ghosts or crawlers. Primarily, the spam will come from ghosts, which never actually visit or interact with your site at all (thus giving them their name). The ghosts send a measurement protocol directly to Google’s servers with a random tracking code to make it appear as if you have received a visit. Crawlers actually visit your site, and they can intend to steal your content, hijack your site, or hack your data. Some crawlers are good also, such as the crawlers that search engines send to your sites to collect data. Both ghosts and crawlers can make it appear as if you are getting more traffic than you are, which can negatively affect your search ranking and can throw off your marketing strategy.

Best Option for Dealing with Spam

Dealing with spam in your analytics is as easy as setting up a filter on your dashboard. You’ll still get the hits, but they won’t be counted into your traffic. When you look at the referral sources to your site in your analytics, you will see the source and the host name. Most spam sources will use a fake host name, or they will leave it blank. You can make a filter that ensures you only see traffic from sources with valid host names. To set the filter, go to the reporting tab in your analytics dashboard and choose “audience” in the panel on the left side of the page. Under audience, you’ll see “technology.” Click the drop-down menu and choose “network.” Then choose “host name” at the top right of the report.

You will see a list of all the domains that have visited your site, and you can create a list of the legitimate domains to include in a regular expression. The expression should look like this:


… and so on.

Create a custom filter and choose “include.” Under that option, choose “host name” as the filter and then paste the expression you created in the filter pattern box. That filter will take care of crawler spam in your analytics. To block ghosts from your analytics, you’ll have to add some code to your .htaccess file.

Add these lines of code:


RewriteCond %{HTTP_REFERER} semalt\.com [NC,OR]

RewriteCond %{HTTP_REFERER} buttons-for-website\.com [NC]

RewriteRule .* – [F]

Just be careful when adding any code to your .htaccess file. A single errant character could cause your site to crash.

Mistakes to Avoid

Analytics spam is such a big problem that site owners have tried numerous tactics for removing it. Yet many of these tactics have failed.

One of the biggest mistakes that people have made — and that you should avoid — is to add ghosts to the .htaccess file. Ghosts don’t actually access your site, so the .htaccess file can’t actually block them. Meanwhile, you end up adding a lot of useless code to your .htaccess file and you increase the chances of causing error to your site by tinkering with the code.

Another common mistake that people make is to confuse spam with hackers. They see the fake domains, and they think that their site has been compromised. They might then spend a lot of time or money trying to root out malware or protect the site from any future vulnerability.

Finally, many site owners make the mistake of worrying that the bounce rate shown in their analytics report will negatively impact their search ranking. Since ghosts only send the data to Google analytics and don’t actually visit your site, they don’t contribute to a bounce rate outside of your analytics.

Google will evaluate your site based on a variety of metrics, so this bounce rate should not affect you.

You rely on your Google analytics to make important decisions about your site, including how to change your marketing. Spam visits can end up costing you a lot of time and money on erroneous strategies.

Spam visits can also cost you advertising dollars. You may promote your site as having more visitors, and then your advertisers may be disappointed that they didn’t get the results they expected.

Follow these tips to root out the spam in your analytics and get the reliable information you need.