I'm not sure if this is quite the right place to post this, but it seemed the most appropriate!I'm using Google Analytics to track metrics from a mobile app using the Measurement Protocol, however I'm getting an awful lot of spam coming though.A bit of searching led me to things like this:How to fight off Google Analytics referrer spammers?that basically suggest adding a filter that only lets through things from a known host name. This is fine for a website, but isn't very useful for a mobile app as there isn't really a 'host' that valid data should be coming from (or am i missing something?).What's the best way of filtering out the GA spam for a mobile app using the Measurement Protocol.
Block spam from Google Analytics Measurement Protocol for Mobile Application
google analytics;spam prevention;google analytics spam
The best way top avoid this is to set up a segment for you property such that is only includes data with a specified Application ID.Now, simply send that Application ID with every hit that you send to Google Analytics and it will be included. The spammers won't know what application ID to use and so all their traffic will be blocked from that segment view.Also, as mentioned by adam-asdf:Don't use a GA ID ending in 1. Every GA account at some point had a profile ending in 1, like UA-XXXXXXX-1. So spammers just write programs that send hits to GA servers for every variation of UA-XXXXXXX-1--creating a new profile in the same account would give you UA-XXXXXXX-2 and would likely avoid most ghost hits.