3rd Party Custom Consent Manager JS API Issue

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!

In general, it should work. Just correct the json object you pass:

{consents: {analytics: {status: 1}, remarketing: {status: 1}}}
1 Like

@Tom, @kuba,
This is great! We’re using Cookiebot instead of Cookiehub, but I’m really interested in getting this to work. Would this work for Cookiebot as well?

As the Tag Manager doesn’t allow for trigger groups at the moment, I built a custom event to check marketing consent before triggering a Facebook conversion for example. Would be great if that would work with the consent settings for the conversion tag.

Any pointers where to start?

Yes, additional datalayer events are a nice workaround. I’m sure that trigger groups will be added somewhere along the road.

Integrating with external consent manager is all about checking their api and events meaning that a certain consent has just been given. We have plans to publish official integrations for onetrust and cookiebot but there’s no eta yet.

1 Like