How to setup Cloudflare Web Analytics with Piwik Pro


I have implemented the following solution: How to setup Cloudflare Web Analytics with Google Tag Manager |

so far I did the whole setup in google tag manager, and now i want to connect to my Piwik pro consent form.

how do I include this Cloudflare tag that i created in Google Tag manager in my Piwik Analytics Consent form.


Hi Sall,

Hope you’re fine!
Just to confirm, currently you use Piwik PRO consent form and you would like to copy described approach from GTM to Piwik PRO tag manager and based on specific PP consent trigger Cloudflare tag?

Hello Adam,

thanks for your reply.

Yes, if user Agree to Analytics Tracking, Cloudflare Tag should be fired, or declined.

Thanks a Lot!

In this case, if you use our consent manager, all you need to do is to use custom code tag and in its advanced settings choose analytics consent type. Then, whenever user give consent to analytics this all tags with above settings will be triggered.

Hi Adam,

thanks for your answer, that means i have to create a tag inside piwik pro and copy the same cloudflare analytics code i set up in google tag manager? That means the code will be twice, once in google tag manager and once in piwik pro right?

best wishes

Hi Sally,

If you implement it both in GTM and PPTM, then yes. I would recommend to keep it only in our tag manager if you use our consent manager as well.

Hi Adam,

I implemented exactly how is describe in the link I sent you, means only in Google tag manager. That means instead of implemented in Google Tag Manager i should implemented directly in Piwik pro? and have just one tag ( just in piwik Pro instead of GTM?)


Hi Sally,

That would be the easiest way if you implement if in Piwik PRO tag manager because you can easily choose which consent should be given to trigger specific tag. Otherwise, if you prefer to use GTM and our consent manager, you should proceed with below integration: Consent Manager integration with Google Tag Manager | Piwik PRO help center

Hi Adam,

yes i would like to have it GTM, that means i just have to create a tag in piwk pro with this code:

and i put the name cloudflare analytics, and it will be automatically connected with the one i created in GTM, right? because the connection, between GTM and Piwik Pro is anyhow done since two year
like you can see in the screenshoot

Hi Sally,

If you would like to use this tag via GTM and based on Analytics consent from our banner trigger the tag, then you should proceed with integration: Consent Manager integration with Google Tag Manager | Piwik PRO help center

If such integration is already working in your setup, then you should use trigger described in point 7 for Cloudflare tag

Hi Adam,
thanks for your answer. Now that i have the GTM cloudflare Tag, and Piwik pro is connected to GTM. i created ( following your instructions) a new tag in piwik with the name cloudflare_analytics with the following code:

  window.dataLayer = window.dataLayer || [];
    'event': 'stg.consentDecision',
    'analytics_consent': 'on',

If someone reject the cookie is not fired ( under the debug mode) but i can still see in Cloudflare, that even the cookie was rejected Cloudflare is still tracking… what can i do in this case? because if the cookie is rejected cloudflare should not track at all…

Hi Sally,

Could you please share link to the website, here or via DM?