Online Authority Blog

How to remove referral spam from your Google Analytics reports

by Kelly Kubrick on March 5, 2015

Referral or “ghost” spam is ‘bad’ traffic that can inflate your digital analytics reports and make it appear like your website is receiving more visitors than usual. It’s often characterized by very high bounce rates with one second or less session duration, and 100% new visits. To learn more, see the “Vanquish Referral Spam” section in this blog post.

I realize this probably looks overwhelming, but it looks worse than it is…and once you get into a groove, it’ll go faster. The first major clean up is always the worst, but once you start doing this monthly, you’ll be getting excluding a handful of spammers at a time.

Step 1: In Google Analytics run and export an extended time frame of the Referrals report:

  1. Change the calendar to an extended period e.g. 2 years
  2. Go to Reporting > Acquisition > All Traffic > Referrals and expand the number of rows to 500
  3. At the top of the report, click Export > XLSX

Step 2: When that report launches in Excel, click the 2nd tab, called Dataset1

  1. Click Data > Filters, which will enable you to filter the data to sort through it faster
  2. In Column G, Avg. Session Duration, click the little down arrow to open up your filter options. Click “Sort Smallest to Largest”, which will bring all the 0.00 second session duration to the top of your list
  3. Review the resulting sites listed in column A, and delete any that are legitimate referrals as we only want to identify the spammers
  4. You should end up with a list of spam sites. If you’re unsure of a particular referral, check the “pages per visit” metric. If it is 0 or 1, and has a session duration of 0.00, it’s spam – see the featured image above for examples

Step 3: When you have a final list, cut and paste column A into Notepad (or a similar no-formatting tool)

  1. Format the groups into a single line of text separated by vertical pipes|no spaces between each, so you get something like”
    “traffic2cash.xyz|best-seo-offer.com|www.event-tracking.com|semalt.semalt.com|www1.social-buttons.com|buttons-for-website.com|share-buttons.xyz|net-profits.xyz|free-social-buttons.xyz” FYI – that text string above is 182 characters; you can check using something like http://www.lettercount.com/
  2. Add one more character – a backslash before every period, so the above now looks like “traffic2cash\.xyz|best-seo-offer\.com|www\.event-tracking\.com|semalt\.semalt\.com|www1\.social-buttons\.com|buttons-for-website\.com|share-buttons\.xyz|net-profits\.xyz|free-social-buttons\.xyz”
  3. Create groups of about 10-15 referral sites. Don’t go much bigger than that as each final filter text string cannot exceed 256 characters, including the vertical pipes and periods. The amended string above is 194 characters – again, checked using http://www.lettercount.com/
  4. Save that file somewhere close by…

Step 4: Go back into Google Analytics > Admin > Account > All Filters and click + Add Filter

  1. For Filter Name, because you’ll be creating multiple filters, use a standard naming convention like “Exclude spam referral 1 of 10 – created 5Nov20XX”
  2. Click Custom > Exclude > Filter Field = Campaign Source
  3. In Filter Pattern, cut the 1st of your referral spam groups from Step 3, item 4 above
  4. Apply the filter to the TEST views only (so that you can see if they are working)
  5. Click Save
  6. Repeat for all remaining groups
  7. Annotate (need instructions how to do that? see this post: what you’ve done in TEST

Step 5: A week or so later, go back in and check your data in your TEST view

  1. Run the calendar for the last week
  2. Compare Reporting > Acquisition > All Traffic > Referrals between Test and Master views
  3. Assuming all is well i.e. that you see a decline in referral spam in Test, apply the filters to Master
  4. Go back into Google Analytics > Admin > Account > All Filters
  5. Click the name of the filter to edit it, and add it to Master view using the Add > to “Selected Views” tool
  6. Click Save
  7. Annotate what you’ve done in Master
  8. Pat yourself on the back!

Once you get the worst of the spam cleaned up, you can make a reminder to yourself to keep an eye on your Referrals traffic, and potentially add/edit new filters monthly. That’s why it’s important to add the ‘created date’ to the filter name, as you’ll be able to run the data as of that date next time thus saving yourself guesswork on what you’ve already excluded.

Have fun…!

Kelly Kubrick

Digital Analyst and President of Online Authority; COO of MyLiberty.Life; co-author Six Dimentions of Digital Maturity Model; co-founder Digital Strategy Conference; co-owner 3rd generation family business. Downhill Skier. Foodie. Fan of all things digital.

Kelly KubrickHow to remove referral spam from your Google Analytics reports

Related Posts

Take a look at these posts

Join the conversation

This site uses Akismet to reduce spam. Learn how your comment data is processed.