Hi,
I’m currently trying to use a 3rd party CMP (Cookiehub) integrated into Piwik Pro using tag manager and Piwik Pro’s JS consent API to feed the user’s consent into Piwik Pro.
So far I’ve managed to activate the consent for each category (aligned with the 3rd party consent category’s) which responds to both allowing cookies and declining them, however it’s resulting in 6 consent decisions showing up (one for each category as they change from no to yes) instead of one with them all on.
I realise that this is happening because there is a separate API call for each category, however when I attempt to put multiple categories within the same line, it only ever activates one of them…
eg.
ppms.cm.api('setComplianceSettings', {consents: {analytics: {status: 1}} && {remarketing: {status: 1}} }, function(){}, function(){});
My code with seperate lines:
<script type="text/javascript">
var cpm = {
onAllow: function(category) {
if (category == 'analytics') {
ppms.cm.api('setComplianceSettings', {consents: {analytics: {status: 1}}}, function(){}, function(){});
}
if (category == 'marketing') {
ppms.cm.api('setComplianceSettings', {consents: {remarketing: {status: 1}}}, function(){}, function(){});
}
if (category == 'preferences') {
ppms.cm.api('setComplianceSettings', {consents: {ab_testing_and_personalization: {status: 1}}}, function(){}, function(){});
}
if (category == 'analytics') {
ppms.cm.api('setComplianceSettings', {consents: {conversion_tracking: {status: 1}}}, function(){}, function(){});
}
if (category == 'marketing') {
ppms.cm.api('setComplianceSettings', {consents: {marketing_automation: {status: 1}}}, function(){}, function(){});
}
if (category == 'analytics') {
ppms.cm.api('setComplianceSettings', {consents: {user_feedback: {status: 1}}}, function(){}, function(){});
}
},
onRevoke: function(category) {
if (category == 'analytics') {
ppms.cm.api('setComplianceSettings', {consents: {analytics: {status: 0}}}, function(){}, function(){});
}
if (category == 'marketing') {
ppms.cm.api('setComplianceSettings', {consents: {remarketing: {status: 0}}}, function(){}, function(){});
}
if (category == 'preferences') {
ppms.cm.api('setComplianceSettings', {consents: {ab_testing_and_personalization: {status: 0}}}, function(){}, function(){});
}
if (category == 'analytics') {
ppms.cm.api('setComplianceSettings', {consents: {conversion_tracking: {status: 0}}}, function(){}, function(){});
}
if (category == 'marketing') {
ppms.cm.api('setComplianceSettings', {consents: {marketing_automation: {status: 0}}}, function(){}, function(){});
}
if (category == 'analytics') {
ppms.cm.api('setComplianceSettings', {consents: {user_feedback: {status: 0}}}, function(){}, function(){});
}
},
};
(function(h,u,b){
var d=h.getElementsByTagName("script")[0],e=h.createElement("script");
e.async=true;e.src='https://cookiehub.net/c2/xxxxxxxx.js';
e.onload=function(){u.cookiehub.load(b);}
d.parentNode.insertBefore(e,d);
})(document,window,cpm);
</script>
The result:
Any help on this issue would be much appreciated!