Reputation: 51
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
Reputation: 760
I've made some chrome extension, feel free to use it
https://www.youtube.com/watch?v=Wt8NOtzGdds
Upvotes: 0
Reputation: 106
If you have more analytics and so on, you can do like:
Define a function which creates a variable on call:
<script type="text/javascript">
function setOptOut() {
localStorage.setItem('optout', 'true');
window.location.reload(false);
}
</script>
Insert the call where you find //disable cookies like:
setOptOut()
Load scripts only if not opted out:
if (!localStorage.getItem('optout')) {
//your tracking scripts
}
Upvotes: 0
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