3

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?

Tatsuyuki Ishi
  • 3,883
  • 3
  • 29
  • 41
  • 4
    Best solution: switch hosts. (It's likely that the TOS prevents you from messing with their GA code.) – JJJ Dec 02 '13 at 08:56
  • Check out why your hosts integrate Analytics, maybe they want to provide analytics data to you, not for themselves - which would not be all that different from using owa. Plus you could place a link to the opt-out tool prominently on your homepage (https://tools.google.com/dlpage/gaoptout). All in all I'd agree with Juahana that switching hosts is the best option. – Eike Pierstorff Dec 02 '13 at 10:00

1 Answers1

5

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

Eduardo
  • 22,574
  • 11
  • 76
  • 94