Referrer spam is one of the more frustrating developments on the web in recent years. The premise is simple enough, a site owner sees a new referrer in their analytics and visits the website in question to investigate the source of new traffic.
The page in question does not contain any such links and instead advertises anatomical enhancements or attempts to install malware on the visitor’s computer.
Of the top ten referrers to my site in Google Analytics, seven are spammers. It’s an annoyance more than anything, all the same I’m trying a technique to kill it dead once and for all.
For the most part, referrer spammers do not hit your site. They don’t need to, they just run the Google Analytics code using incrementing tracking ids: UA-10000001-1, UA-10000002-1, UA-10000003-1, and so on and so on.
This gives site owners an advantage, the referrer spammers know nothing of custom dimensions the website owner has set. Google Analytics allows owners to include only traffic which includes a particular custom dimension.
I use a few custom dimensions, but not the allowed twenty. I decided to set up a dimension to appear on all page loads on my site. I wanted to use dimension20
, so I filled the remain spots through to 19 with unused and inactive custom dimensions. In position 20, I added the dimension h8referrerspam.
To my Google Analtyics, code I added the new custom dimension using the same value on all pages:
ga('create','UA-NNNNNNNN-1','auto',{'allowAnchor':true});
ga('set', 'dimension20', 'idontwanttobeacouch');
ga('send','pageview');
I went with a silly in-joke between my partner and I because it had to be something.
In Google Analytics, I then set up a filter:
- Name: h8referrerspam
- Filter type: Custom, include
- Filter field: Custom dimensions > h8referrerspam
- Filter pattern: ^idontwanttobeacouch$
- Case sensitive: checked
I don’t think it will remove all the referrer spam, some do hit the site and run the JavaScript but I’ll be interested to see how much it helps over the next few months. Wish me luck.
@pwcc Why did you have to use dimension20 and fill the other unused ones?
@tyssen I use a WordPress plugin, I wanted to make sure I didn’t end up blocking any future dimensions it adds. Probably unnecessary.
@pwcc Right, thanks.
@pwcc I have been wracking my brain for a solution to this for ages now. Interested to see how this goes. Keep us updated.
@nickspiel Will do, reckon I’ll have an idea in about a week but need a month or two to get some solid data.
Hello Peter any update on this?
It’s been going well, the referrals page remains mostly real sites.
There is still too much spam, for which Google should be condemned. Gmail shows they know how to deal with spam; they are choosing not to for GA.