Google Consent Mode with GTM


Is there a way to apply Piwik Pro’s consent management with Google Tag Manager and Google Consent Mode?

I have implemented Consent Manager integration with Google Tag Manager | Piwik PRO help center but I ideally want to implement Google consent mode integration | Piwik PRO help center but the article says “This integration doesn’t work with Google Tag Manager.”

Basically, with the consent management GTM integration, the GA4 tag will only fire if analytics_on, but ideally I want to enable GA4 to ping under cookieless conditions.

Is this possible?

Thanks in advance,


you could make sure Consent Mode is initialized correctly before you load a Custom HTML tag that includes a regular gtag GA4 script code. Init Consent Mode in that tag before loading GA4 if not handled otherwise. If you fire this tag without consent conditions in Piwik PRO Tag Manager, you should see hits with a gcs=100 parameter indicating that it works.

Then add a second tag that needs Analytics consent to fire and update Consent Mode (just the update, no second GA4 code) there to allow analytics_storage. Add an appropriate delay (wait for updates) in the script code, so that GA either fires in Consent Mode or include cookies according to the current consent state.

All that said: think twice if you really want to use Consent Mode. It is full blown tracking (minus cookies and therefore without a constant client id but everything else) without consent for Google Analytics.

All dimensions are collected like without Consent Mode there and get sent to Google (which is not comparable to Piwik PRO data capturing without consent), just no cookies are used.

Even if a visitor actively denies tracking. But consent is not only about cookies… Despite what Google claims, this should never happen (Google is still Google). Ask your data privacy person again about that to be sure this is really what is considered “okay”.



Thanks for the advice Markus.

I am ‘thinking twice’ about the suitability of Google consent mode, mainly due to lack of detail even when consent mode is in place. This is why I am using PiwikPRO for core tracking data and reporting but still need (as much useful) data in Google for marketing purposes.

When you’re suggest implementing the gtag GA4 script, is this within Piwik Pro’s tag manager? Currently I’m trying to use Google Tag Manager for GA4, and only have Piwik Pro TM for PP analytics tags.

Also, when you mention adding a second tag, is this also to be loaded within Piwik Pro?

I tried to use the instructions in Google consent mode integration | Piwik PRO help center creating status change tags for granted/denied in PP which can then be read by GTM tags, but I found that after the initial hit/event which did update the consent status, any subsequent pageview didn’t keep the consent status and reverted back to the default.
Not sure if this was user error or totally incorrect implementation since the guide did advise this wasn’t possible…

I re-read my answer and understand your confusion - Sorry for that. So once again in different steps for either Google Tag Manager (GTM) or Piwik PRO Tag Manager (PPTM):

  • as you want to use GA4 in GTM: implement GA4 there. It may fire without consent, but there must be Consent Mode initialization stuff in the dataLayer before that. You could (as there is no consent manager that handles this for you) manually push commands that deny analytics_storage and other options as well; including a “wait_for_update” of 500 or higher with a Custom HTML Tag in GTM that also pushes an event to the dataLayer that you can then use in order to fire your GA4 Config tag from within GTM

  • in PPTM, create a HTML tag with a script that updates Consent Mode to allow analytics_storage for example and define that it needs “Analytics” consent. It is a good idea to add an event (e.g. event: “analyticsConsentGranted” or any other unique name) and a dataLayer variable (like analyticsConsentGranted : true) to the dataLayer here as well as you can use this event and / or variable to know when / if there is consent for “Analytics” inside GTM as well. So basically the same thing like shown under the first link from your post, but adding Consent Mode commands before that.

Whenever there is “Analytics” consent granted (after interaction or loading a page with existing consent), the tag from PPTM will either update consent state before GA tags fire within GTM.

You can add more tags to PPTM for consent types like “conversionTrackingConsentGranted” or whatever you want to ask for and then use in GTM. Every consent status will be communicated by your tags in PPTM via dataLayer with those “analyticsConsentGranted” events and variables.

I hope this explains the process (of which I hope it really works as I am not a fan of Consent Mode at all)?

At least the “asking for consent in PPTM and using it in GTM” part is proven to work as I use it on my own and some other websites. And who pushes Consent Mode commands to the dataLayer (PPTM, a website or any other consent manager) should not make any difference… except for timing issues. So if you run into race conditions, a different trigger concept might be necessary…

You do not need much details from Google. Just activate Consent Mode and look at outgoing requests in the network tab or use a debugging browser extension. Even if you do not know what exactly happens to the data where it attrives: the problem is sending those “pings” (to a Google server) that include all dimensions just like any “full blown” analytics hit. Every custom dimension, screen resolution, every ecommerce info you might be sending to the dataLayer…, all tracking parameters. Would you expect a website to do this - even if you denied “Analytics”?