How to block loading scripts before consent without using tag manager?

Hi, could someone explain me how to encapsulate the code for scripts that are loaded outside Piwik tag manager? I have done it with other CMP’s but I couldn’t find a clear explanation.


I was about to ask the same thing. It took a look at few “script blocking” solutions which were quite heavy but something similar should be used and hooked to Piwik API to allow script loading after consent is given.

I think that Piwik API should be extended to provide a mechanism for this since it already has a blocking mechanism which should be easily integrated to other scripts for example by adding classes or custom attributes to script tags. It that case it wouldn’t “interfere” with the system were it is installed but would provide a way to integrate it and thus enabe control of scripts per consent.


With other CMPs they usually have a script that does the job. I would really need a similar solution that works with Piwik Pro CMP. Just an example below.

type="text/plain" data-cookieconsent="analytics

Hi. Thanks for the feature request - I’ll forward it to the product team.

As a side note, it’s a double-edged sword. :slight_smile: So, blocking only elements with the data-consent tag would be the way to go.

Hi! Blocking single elements/scripts is exactly what I’m trying to do here. Did your product team come up with anything yet?

We’re working on a guide describing how to do it with the current feature set. It should be published within the next few weeks.