You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
how can I wait wit a JS function until the user have accepted or deccline the consent window?
I'm not shure if the watcher is the right tool for that. And if yes how have I to use it?
The manual is a little bit written on the diet way.
Best
The text was updated successfully, but these errors were encountered:
The easiest way is to write it directly into the config at a service's callback property:
constconfig={services: [{name: 'googleAnalytics',callback(consented,service){console.log(`Consent status for ${service.name}: ${consented}`)}}]}
If you need to do this in a specific place in code, you can use the ConsentManager to register a watcher:
constmanager=klaro.getManager(config)// Use the same config object you used for initializationmanager.watch({update(config,eventName,consents){if(eventName!=='consents')returnconsole.log(`Consent status for google analytics: ${consents.googleAnalytics}`)}})
Code is untested and might need minor fixing, just writing this from memory.
Hi,
how can I wait wit a JS function until the user have accepted or deccline the consent window?
I'm not shure if the watcher is the right tool for that. And if yes how have I to use it?
The manual is a little bit written on the diet way.
Best
The text was updated successfully, but these errors were encountered: