Basic Reasons To Remove Localhost From The Referrer List – Practice From Semalt

Lisa Mitchell, the Semalt Customer Success Manager, says when you have a website, your team is bound to be testing this and that. If at any time somebody from your team is running the development version of your web app with Google Analytics tracking code, then they're bound to bump into some annoying things.

For a start, localhost keeps showing up in the Referrers reports. Secondly, your website's metrics such as the bounce rate, number of page views, conversion rates and so forth. As it is, these metrics will be skewed because as the team member performs a test on the website, things get mixed up. You wouldn't want that, will you?

A quick fix

You can remedy this situation in a very easy way. In fact, you have three ways at your disposal. Regardless of your choice the fix only works for new visits. The existing data will remain tainted, and you cannot do anything about this.

Add an exclusion filter on Google Analytics

Adding an exclusion filter on your Google Analytics account is the simplest and easiest way to remedy the system from mixing up different metrics. You wouldn't even need intervention from the technical team. Here are some tips:

  • open your Google Analytics account then select 'Admin.'
  • own the view column click 'Filters'
  • set up a new filter by opting for 'New Filter'
  • create new 'Predetermined Filter,' which will exclude web traffic to 'localhost' host name.

Note that you may have to change the localhost name to whichever local host name your team uses. Better yet, if the development team happens to share your network, then you can exclude the entire IP range. This way, your metrics won't be jumbled. Simply set your filter to exclude 'traffic from IP addresses, ' and you're done.

Changing the JavaScript tracking snippet to exclude the host

This is a reasonable choice compared to messing up with Google Analytics filters. Just go to the tracking snippet and identify the property ID used to keep tabs on analytics. If you might have upgraded to Universal Analytics, then you'll bump into something like this: ga('create', UA-98765432-1', 'website.com').

Note that instead of example.com, you'll actually use your real domain. Fortunately or unfortunately, you'll have to be adept in technical jargon. For instance, you may have to use an if-statement somewhere on the code. Although there has been a mention of the process being simple, it requires writing new code.

Skipping the JavaScript snippet in your template

If your website uses PHP language like the case of WordPress then you could edit the footer which coincidentally includes Google Analytics snippet. There is even the possibility that your server allows for web apps to run in development mode or in production. Whatever the case, you can never go wrong.

Moving on

Once you have made these changes, there is need to see whether they are effective or not. Do a test a day or two later for confirmation. Choose an appropriate data range, one that does not include the days before the change.