Hey all,
We are migrating to Piwik PRO CMP & Tag Management.
Currently I am changing the way we handle cookies to use the Piwik ppms.cm.api, however I notice there’s no way to “react” to consent changes like for example CookieBot has it.
Is that correct? Or is there a “hidden” way to interact with consent changes.
What I want to do is; When a user changes their consent I want certain functionalities of the site to load.
We are using the default Piwik consent bar.
Hello @1337LutZ and welcome to the community
I’m not sure if this is what you are looking for but you could try to use a custom event stg.consentDecisionMade
for consent changes.
If you want to do something when banner is accepted or declined you would have to use stg.saveChoicesClicked
, stg.agreeToAllClicked
and stg.rejectAllClicked
.
You can preview events in debug mode in tag manager to see if your actions are fired correctly.
Let me know if this solves your problem!
1 Like
Thanks for your quick response!
My intention is to listen to these events in Frontend code (client side Javascript), not in Tag Manager.
Is hat possible? Or does Tag Manager offer an option to subscribe to the events on the client side?
Regards,
Adrian
I think you can do few options:
- If the code can be run in Piwik PRO Tag Manager - you could do custom html tag, use custom events above as triggers and run some functions changing website in tag manager itself as a script or style tag.
- If it has to be on website - Observe
ppms_privacy_<appID>
cookie changes, and then run your code if it detects changes.
- Create function in code that listens to dataLayer changes - and if it detects key
event
matching anything from above it runs your code changing frontend
Thanks for the options!
- Yes, it needs to be on the website.
- The only way to observe cookie changes is using the Cookie Store API which doesn’t have Firefox support yet. But this was indeed my idea.
- This was another idea I had as well. How would you approach this? Does Piwik offer this ootb? Or would I have to write custom code for this?
Overall I think having Events that Piwik exposes is a core functionality and something this product can really use.
There is no out of the box option for number 3 but I will pass your feedback to our team. Thanks!
1 Like