Skip to content

Blocking scripts

Konstantinos Pappas edited this page Mar 19, 2025 · 4 revisions

In order to be GDPR-compliant, you need to conditionally load third-party scripts once users have given their consent.

In this section, we’ll explore the various ways to block those scripts from running, until the user has given consent.

Controlling scripts automatically

Blocked Scripts tab

  1. Enable Page Scripts, under the “General” tab of the cookie consent plugin
  2. Configure the “Blocked Scripts” tab (for more information, refer to the Blocked Scripts section of this wiki)
  3. That’s it! 🎉

How does it work?

The plugin will automatically:

Controlling scripts manually

If your theme/plugin contains a <script> tag you can control, you have to:

  1. Enable Page Scripts, under the “General” tab of the cookie consent plugin
  2. Set the type of your script tag to "text/plain"
  3. Set the data-cookiecategory attribute to "analytics", "targeting", or "preferences"
<script type="text/plain" data-cookiecategory="analytics" src="analytics.js" defer></script>

<script type="text/plain" data-cookiecategory="targeting">
  // Targeting JavaScript
</script>

Clone this wiki locally