Complianz, Google Tag Manager and WooCommerce
-
Hello everone,
thank you for your plugin. I am currently trying to integrate Complianz, Google Tag Manager and WooCommerce, following this guide and this document.Situation: To push eCommerce related events to Google Analytics we have to check first if consent is given for the “statistics” category in Compliance.
Approach: To do that I am using a trigger, that fires upon the GTM4WP ecommerce events, but checks first wether consent has been given.
I do this by using a custom Javascript function and a 1st-Party Cookie variable.
This is the Javascript I am using:
function() { var c = {{Complianz Cookie Value}}; try { var consent_status = JSON.parse(c); if ( cmplz_has_consent(statistics) ) { return cmplz_has_consent(statistics).includes( "allow" ); } } catch (err) { //something went wrong with JSON decode, perhaps cookie is empty or undefined } return undefined; // could be also false }
Essentially, I am just trying to check wether consent has been given or not and store that value.
And this is the shareable debug link – I’d expect the javascript (and the cookie) to return a value on the gtm4wp.addtocart events.
I suspect that I am misinterpreting the developer guide you’ve posted above, but after an hour of trying to get it to work I may be running in circles. Can I ask you to help, please?
Best,
FranzThe page I need help with: [log in to see the link]
- The topic ‘Complianz, Google Tag Manager and WooCommerce’ is closed to new replies.