Final weekend, I wrote a quite simple net app that robotically creates quite a few referral spam filters to deal with the issue that appears to have everyone all riled up.
For a pleasant recap of the scenario, check out this put up by Jeff Sauer, or this text by Mike Sullivan.
This isn’t an opinion piece, although I’ve acquired a large number of opinions about this problem. If you wish to learn some dialogue surrounding this, check out this Google+ thread.
(UPDATE: I’ve taken down the demo instrument. You possibly can nonetheless obtain the supply code under if you want, however there are extra strong methods to dam GA spam than creating a person filter for every referral.)
The instrument known as the “Spam Filter Insertion Device”, or SFIT for brief (I dare you to begin utilizing that in your on a regular basis lingo).
X
The Simmer E-newsletter
Subscribe to the Simmer e-newsletter to get the newest information and content material from Simo Ahava into your e-mail inbox!
Obtain the supply code
The actual meat of the answer is within the GitHub repo.
You possibly can obtain the supply code, set up the applying by yourself net server, and use it in your personal functions.
The applying has entry to the next options of the Google Analytics Administration API:
-
READ the record of accounts, properties, and profiles you’ve got entry to
-
INSERT or UPDATE profile filters on the account stage
-
INSERT profile filter hyperlinks, which connect the newly-created or up to date filters to the chosen profiles
To get it up and working, you will want to register a brand new mission within the Google Builders Console, create a brand new Shopper ID for an online utility, in addition to a public API key. Keep in mind to activate the Google Analytics API as properly!
The way it works
If you click on Initialize, the instrument requests your authentication to do all kinds of horrible issues to your GA account. Don’t worry! This instrument primarily solely INSERTs and READs. The one exception is that if you have already got these spam filters put in in your GA account, however they’re outdated, through which case the instrument will robotically replace them to their latest variations!
When you’ve authenticated your account, you may be served a drop-down menu from which you’ll select any GA account you’ve got EDIT entry to. Why EDIT entry? As a result of that’s the required entry stage for brand spanking new filter creation. You learn that proper! To create filters, you want EDIT entry on the account stage.
Anyhow, select an account and the instrument ought to shortly load with a a number of choice menu, the place you possibly can decide the profiles to which you wish to hyperlink the filters.
When you click on the Create and apply filters, the instrument does simply that. First, it creates the filters on the account stage, after which it hyperlinks every filter to the profiles you chose.
The record of filters is the one maintained in this Lone Goat useful resource. At any time when they replace the record, I replace these filters. Which brings me to the…
Caveats
These filters solely assist with referral spam. They won’t assist you to with polluted Measurement Protocol hits, or with spam that doesn’t are available in as referral site visitors, or with spam that is available in as referral site visitors however isn’t within the filters but. There are lots of strategies to fight this problem, and also you would possibly wish to examine the couple of hyperlinks I had within the very starting for concepts.
Anyway, be happy to make use of the instrument and let me know if there are points.