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?

2
  • 4
    Best solution: switch hosts. (It's likely that the TOS prevents you from messing with their GA code.) Commented Dec 2, 2013 at 8: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 (tools.google.com/dlpage/gaoptout). All in all I'd agree with Juahana that switching hosts is the best option. Commented Dec 2, 2013 at 10:00

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer. Is there maybe an easy way to check if it's working?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.