Manual script blocking guide
Follow our manual script blocking guide to enhance privacy and compliance in your Shopify store.
Learn how to effectively block scripts with step-by-step instructions.
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.
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.
Set the type to "javascript/blocked".
As this tells the browser to regard the script as blocked javascript, this essentially disables the script.
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:
Learn how to effectively block scripts with step-by-step instructions.
Introduction
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.
Video guide
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.
Set the type to "javascript/blocked".
As this tells the browser to regard the script as blocked javascript, this essentially disables the script.
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:
<script type="text/javascript">
document.cookie = "email=johndoe@email.org; expires=Sun, 31 Dec 2023 12:00:00 UTC; path=/";
</script>
To mark up this script to require consent to cookies in the "functionality" category we make it like this:
<script type="javascript/blocked" data-cookiecategory="functionality">
document.cookie = "email=johndoe@email.org; expires=Sun, 31 Dec 2023 12:00:00 UTC; path=/";
</script>
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:
<script type=”text/javascript” src=”https://domain.com/common.js”></script>
To mark up this script to require consent to cookies in the "functionality" category you need to do it like this:
<script type="javascript/blocked" data-cookiecategory="functionality" src="https://domain.com/common.js"></script>
Updated on: 29/07/2024
Thank you!