Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip Google Analytics loading?

Turkish government have blocked some IPs including Google Analytics. This caused all the web sites using alanytics to slow down and even not to load. How can we prevent this problem? How can we skip loading of ga.js if not available?

like image 317
HasanG Avatar asked Jun 08 '10 09:06

HasanG


People also ask

Can you opt-out of Google Analytics?

You can opt-out of having your site activity available to Google Analytics by installing the Google Analytics opt-out browser add-on. The add-on prevents the Google Analytics JavaScript (gtag. js, analytics.


1 Answers

Google offers an asynchronous snippet for their tracking code:

Note that you need to use a different tracking syntax to use it, check the migration guide on the link for details. It also require a browser with support for the HTML5 attribute 'async', so it may not fully solve your problem.

Another solution is proposed in 'Better Google Analytics JavaScript that doesn't block page downloading'

like image 183
Mads Mogenshøj Avatar answered Nov 02 '22 23:11

Mads Mogenshøj