Getting Rid of Google Analytics Spam Languages
Google Analytics spam has been a common problem for a while, but it seems to me that in the last few months it’s gotten markedly worse. Whether that’s just my perception or the reality of the situation, I’m not sure. What I am sure of is that it is annoying that and the latest place the spammers are identifying themselves as flooding you with bad data is in the “Language” that Google Analytics reports for them. We noticed the issue a few months back here on WPShout, but hadn’t gotten around to finding the solution.
Fortunately, our friend Patrick Rauland — he of WooCommerce fame — has just written a great little guide to how to filter out the bogus data that “Vitally is really 1337!” The answer (unless or until Google addresses the problem themselves…) is to put your own filter on Google Analytics.
Patrick’s solution is pretty elegant:
The [spam languages all] have special characters & spaces so it should be easy to match. This regular expression will match any string with an exclamation point or space:
I’m actually okay with this for right now. The spammer may find their way around this and that’s okay because I can always tweak this regular expression.
Read the full article to know where to put that regular expression inside the often-befuddling Google Analytics interface.