Since the Google Analytics snippet is available in the source code of the page (e.g. below is stackexchange's)

   <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-5620270-24']);
        _gaq.push(['_setCustomVar', 2, 'accountid', '148108',2]); 
    var _qevents = _qevents || [];
        var s=document.getElementsByTagName('script')[0];
        var ga=document.createElement('script');
        var sc=document.createElement('script');

I was wondering how Google were preventing people's GA accounts from being spammed. For instance I could modify my /etc/hosts file to point webmasters.stackexchange.com to a server of mine, then on that server I create few dummy webpages with the above GA code, and I could use an automated browser like Selenium to continuously browse these pages and execute the GA code which would generate plenty of requests from my browser to GA.

How does Google prevent people's GA account statistics from being spammed?


there currently aren't any safeguards in place, and while uncommon people can spam your account, for example, if they hold a grudge. If you are spammed you cannot remove this data.

It is best to put in place a precautionary filter, selecting 'include only' and 'traffic from the domains' and setting this to your domain(s) which you want to be included.

|improve this answer|||||

So far as I understand it the tag is locked to traffic from a domain/subdomain or group of domains unless you choose the third option in the tag setup.

Referer spam does happen, but what would you achieve by doing this?

|improve this answer|||||
  • 1
    what would you achieve by doing this?: well given how valuable analytics are to any web company for understanding its business I could imagine companies using such techniques against competitors to render their GA account unusable. – Max May 15 '12 at 19:09
  • @user359650 for ecommerce companies maybe, but serious people use more advanced tools than GA. Most of the companies I've worked for over the years are interested, but in nothing more than headline numbers. Anomalous traffic would show up pretty quickly and there really isn't any money in doing this beyond f**king with people. – toomanyairmiles May 15 '12 at 19:12
  • can you give examples as to what those more advanced tools than GA are please? – Max May 15 '12 at 19:16
  • 1
    @user359650 Market leaders are Omniture and WebTrends, their tags are more scriptable and software generally more configurable. Google limits goal tracking and funnels, doesn't re-analyse data and isn't terribly helpful for very advanced ecom or log analysis. – toomanyairmiles May 15 '12 at 19:25
  • @user359650 basically Google runs analytics as a way of acquiring better data about sites and as a tool for adsense users, that's really the scope of it's interest. – toomanyairmiles May 15 '12 at 19:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.