So, What Should You Do About Ghost Referral Traffic?

No Comments


Now that you know what ghost referral traffic is and how wicked and dangerous it can be, I am sure you would also like to know what measures you can take to deal with the problem. To start off, the questions that you would logically ask right now should be along these lines:

  • What can I do to prevent ghost referral traffic from appearing in my Analytics reports?
  • How can I remove ghost referral sources from my Historical data?

Let us take a look at those questions one by one so that it will be easier for you to grasp the way ghost referral traffic works and understand how you can rid your future Google Analytics reports of them.

How to Prevent Ghost Referral Traffic from Appearing in Your Analytics Reports

The unfortunate thing about ghost referral traffic is that these visits are not from spiders or bots that actually pay your site a visit, so it is impossible to block them like you would any bots and spiders. This makes it more difficult to filter them out of your Analytics reports, but do not be disheartened because doing so can be a lot easier than you may think!

The best way that you can prevent the inclusion of ghost referral traffic in your Analytics data is by filtering them out. Google Analytics has some powerful options that will help you to get rid of the unwanted “ghosts” (note, however, that this method will only eliminate most ghost referral traffic, since there are new sites coming online each day that are able to spoof your Analytics reports).

Here is a word of advice before I continue to tell you about how you can use filters to eliminate ghost referral traffic from your Analytics report: NEVER use the Referral Exclusion List feature, which can be found in the Admin–>Property–>Tracking Info section of Google Analytics. This feature does not work.

It actually causes the session of a ghost referrer to change to a direct visit, which will make them continue to appear in your Analytics reports. In addition, making changes to your .htaccess file does not work because the hits seen in the Google Analytics report made by ghost referral traffic are not really hits at all, as there was actually no visit. So trying to block those sites using that method will reap no fruit either.

Before you start adjusting the settings in your Google Analytics dashboard and implement the filters that you create, your website property must always have an unfiltered view with no filters in it. You should create a test view that mimics the main view and add the filters to it before implementing it in your main view and then after testing the new filter, if you are satisfied with its performance, you can go ahead and implement it in the main view.

If you fail to follow those steps, you may end up eliminating valid sessions from your Analytics report that could have proved to be beneficial to you. So it is imperative that you test each filter before fully applying them in the main view of your website properties. Keep in mind, too, that the filters you create will only affect the sessions that take place after they are implemented and will not affect your historical data.

However, there is a way in which you can filter out ghost referral traffic sources from your historical data, which will be discussed later in this article.

One of the easiest filters to create and maintain is one based on valid hostnames. An INCLUDE filter can be created that stores only visits from valid hosts and keep the ones mentioned in “How to Identify Ghost Traffic Sites” above at bay. If done incorrectly, you run the risk of excluding valid traffic from your Analytics reports. This means that you have to take the time to identify ALL hostnames that are valid which may use your Google Analytics tracking ID, like online payment processors and even your own domain.

To do this, log into your Google Analytics account and click on Reporting–>Audience–>Technology–>Network–>Hostname to generate a report that spans a number of years to reflect only hostnames. From the list generated, make a note of the ones that are valid. You must then create a filter that contains a regular expression that will capture all the valid domains. To create the filter, click on Admin, under the VIEW sub-heading select Only my hostnames, then click on Filters. Under the Edit Filter sub-heading, put “Hostnames”(without the quotes) in the Filter Name box, and then under Filter Type click on Custom ->Include -> Filter Field: Hostname. In the Filter Pattern box, type the URLs of the hostnames that you want to filter out. Then click the Save button.


Image Source:

FYI, there is a specific way to write the expressions. Using a few of the ghost referral sites mentioned in “How to Identify Ghost Traffic Sites” as examples, you would write:



Notice that each of the entries is separated by the pipe “|” symbol and no space is between the characters in the expression. There is also no pipe symbol after the last hostname entry. In the first example, using “.*” tells the filter to block all subdomains of the specified domain. In the second example, using the escape “” character ensures that whether or not the “www” is included, it will be filtered out.

Bear in mind that the hostnames you put in the Filter Pattern box are based on the results you get when you generate the hostnames report for the period you specified. The examples I provided are only for reference purposes.

After testing the filter for a while, if you are satisfied with its performance, you can go ahead and implement it fully. You must, however, update this filter each time you place your Google Analytics tracking ID into a new website. Also check an unfiltered view each month to verify that the filter is not excluding valid traffic.

Removing Ghost Referral Traffic from Historical Data

You may have historical reports that you want to filter ghost referral traffic sources from. It is possible to do so using Advanced Segments, as they can be applied retroactively. Segments are used to select sessions that fit a specific set of criteria, so they can be used to eliminate ghost referral traffic sources, giving you untainted historical reports.

I am going to show you how to use a single segment that includes valid hostnames to remove ghost referral traffic sources from historical data. First of all, you need to create a new segment.

To do this, open your Google Analytics page and select the Reporting view. Then click on +Add Segment. Then click on +New Segment and enter a name in the box that defines what the segment does, for example a name like “Ghost Referral Removal.” After you do that, click on the Advanced -> Conditions tab in the left sidebar. Now you need to create a new entry by clicking on Sessions -> Include -> Hostname ->matches regex, then type a regular expression that encompasses the hostnames that are valid. (To obtain the valid hostnames, click on Reporting ->Audience -> Technology -> Network ->Hostname to generate a report that spans a number of years that reflects only hostnames.)

This filter will eliminate all ghost referrals that are present in the historical data. The format that you write the regular expression is just as described earlier. For example, it may look like this:


You now need to exclude spam referrals and crawlers. On that same Conditions page, click the +Add Filter button and click on Sessions -> Exclude -> Medium -> exactly matches, then type “referral” in the box. To add a different filter criteria, click on the AND button. Select Source -> matches regex and type the hostnames of ghost referral traffic sources, separating each of them using the pipe “|” symbol. Here is an example of how it should look (using examples from “How to Identify Ghost Traffic Sites”):|||


Image Source:

If the box is unable to take any more regex expressions and you have more that you want to filter from your historical data, simply click the OR button to add another step to the filter, select Source -> matches regex, and then type in the remaining expressions. Then save the segment using the Save button at the top of the page. You can then test your new segment in combination with the default All Sessions segment and compare the session counts. To run the test, in the All Sessions segment of Audience Overview, click on Custom and click the box beside “Ghost Referral Removal” under Segment Name. Then click the Apply button. The results you get should show the good traffic sources in your historical data being unaffected by the filter while the ghost referral sources should be at zero.


Ghost referral traffic can be very annoying and does affect the validity of the data in your Google Analytics reports. The best way of excluding them from your reports is by using an INCLUDE filter that has valid hostnames to determine the good hostnames that you want to appear in your Analytics report. It is important that you update the filter each time you add your Google Analytics code to new valid websites so that they are not excluded from the report. Also update the hostnames of ghost referral traffic sources in the Filter Pattern box as you discover them. By following all the strategies outlined in this article, you will be able to eliminate the appearance of ghost referral traffic in your Google Analytics reports.

This is author biographical info, that can be used to tell more about you, your iterests, background and experience. You can change it on Admin > Users > Your Profile > Biographical Info page."

About us and this blog

We are a digital marketing company with a focus on helping our customers achieve great results across several key areas.

Request a free quote

We offer professional SEO services that help websites increase their organic search score drastically in order to compete for the highest rankings even when it comes to highly competitive keywords.

Subscribe to our newsletter!

More from our blog

See all posts
No Comments

Leave a Comment