Reputation: 4031
I'm building an website with Open Web Analytics.
My host is an free host and automatically insert Google Analytics.
I want remove Google Analytics because it forces to track users.
I inserted jQuery based node remove code before ga but it still gets loaded.
Like this:
<!-- Remove Google Anaylitics and include OWA. -->
<script src="js/RemoveGA.js"></script>
<script src="js/OWA.js"></script>
//RemoveGA.js
$(document).ready(function () {
$("script").each(function () {
if (this.innerHTML.length > 0) {
var googleScriptRegExp = new RegExp("var gaJsHost|var pageTracker");
if (this.innerHTML.match(googleScriptRegExp) && this.innerHTML.indexOf("innerHTML") == -1)
$(this).remove();
}
});
});
Is there any solution to achieve this?
Upvotes: 3
Views: 6297
Reputation: 22834
You can disable their Google Analytics account from tracking your website by defining the following global variable:
window['ga-disable-UA-XXXXXX-Y'] = true;
Change UA-XXXXXX-Y for the Account number they use.
Source: https://developers.google.com/analytics/devguides/collection/gajs/#disable
Upvotes: 5