Manual script blocking guide
While auto-blocking is a quick and easy way to prevent cookies from being set, there are several reasons to want to consider manually marking up script tags to prevent them from setting cookies prior to consent.
Manually blocking cookies has a far lesser impact on store performance and will prevent cookies from being set even if the Pandectes GDPR Compliance scripts fail to load.
There are also situations where auto-blocking is not a viable solution, as it impacts the store to an extent that requires so many adjustments that manually marking up becomes a lesser ordeal.
Using the data-cookiecategory attribute
In order to block a script, the markup uses two parts. The disabler prevents the script tag from loading and the enabler allows Pandectes GDPR Compliance to enable this script tag if the appropriate consent has been given.
The steps to make it happen are the following and work the same for inline scripts and for external script tags.
Add the data-cookiecategory attribute and assign it one of these values: "functionality", "performance" or "targeting".
This attribute defines the condition under which Pandectes GDPR Compliance needs to enable and load the script.
An example of marking up a script:
The following is a basic inline script that sets a cookie named email:
To mark up this script to require consent to cookies in the "functionality" category we make it like this:
The category may be one of the following: “functionality”, “performance”, and “targeting”. Setting the right category will ensure that the script will be unblocked once the visitor consents to the specified category.
The following is a basic script that loads externally:
To mark up this script to require consent to cookies in the "functionality" category you need to do it like this:
Updated on: 02/05/2023