Replies: 1 comment
-
Hi @azuska, as far as I understand, you'd like to do something if consent has not yet been given, and something else if user has already given his consent. You can achieve this currently by using the option Make sure to set all categories — except the necessary category — as disabled by default by setting toggle: {
value: 'necessary',
enabled: true, // <-- run all scripts under this category without explicit consent
readonly: true
} then you could do something like this: <!--- The below script will always run -->
<script type="text/plain" data-cookiecategory="necessary">
if(!cookieconsent.allowedCategory('analytics')){
// do something when the analytics category has not yet been accepted
}
</script>
<script type="text/plain" data-cookiecategory="analytics">
// do something when the analytics category is accepted
</script> With that being said, I agree that it would be a good idea to have something like |
Beta Was this translation helpful? Give feedback.
-
Hi,
I apologise for maybe stupid question, but I'm not so JS-oriented so I'm struggling a little bit with following...
I have a retargeting code with a variable "consent" having possible values 0 (false) a and 1 (true) based on cookie consent. Is there a way to have some kind of "default state" and then "on accept" state of this variable or the whole block of code?
I would appreciate something like "beforeAccept" method which would be triggered every time until the consent is given by the user.
I'm aware of allowedCategory method, but it works for me only within onAccept method. I am not able to use this as a condition in outer scope due to refference erros.
Sorry once again, I would appreciate your help with this... Thx in advance!
Adam
Beta Was this translation helpful? Give feedback.
All reactions