user8028270
user8028270

Reputation: 51

How to disable cookies with cookieconsent by Insites

I don't understand: https://cookieconsent.insites.com/documentation/disabling-cookies/

onInitialise: function (status) {
  var type = this.options.type;
  var didConsent = this.hasConsented();
  if (type == 'opt-out' && !didConsent) {
    // disable cookies
  }
},

What do I have to put instead of "//disable cookies" to disable the cookies?

Upvotes: 5

Views: 1959

Answers (3)

repo
repo

Reputation: 760

I've made some chrome extension, feel free to use it

https://www.youtube.com/watch?v=Wt8NOtzGdds

Upvotes: 0

nyx00
nyx00

Reputation: 106

If you have more analytics and so on, you can do like:

  1. Define a function which creates a variable on call:

    <script type="text/javascript">
        function setOptOut() {
        localStorage.setItem('optout', 'true');
        window.location.reload(false);
        }
    </script>
    
  2. Insert the call where you find //disable cookies like:

    setOptOut()
    
  3. Load scripts only if not opted out:

    if (!localStorage.getItem('optout')) {
    //your tracking scripts
    }
    

Upvotes: 0

BastianW
BastianW

Reputation: 2658

I think that you could add something like:

window['ga-disable-UA-XXXXX-Y'] = true;

Inside that section (see here). But it mostly depends your needs and your cookies you set.

Additionally I think that the script could be improved to use

  if (navigator.doNotTrack && navigator.doNotTrack === 1) {
    window['ga-disable-{{GA ID}}'] = true;
  }

So we could use the "Do not track" option in the browser here. Not sure if that is already covered in the Insites CookieConsent script.

P.S. Keep noted that there exists currently a small bug (reported here).

Upvotes: 2

Related Questions