The GDPR Cookie Consent plugin has a capability to automatically block the active scripts that inject cookies in the website until the users give their explicit consent. The inbuilt script blocker in this plugin is capable of blocking cookies from the following third-party scripts:
Apart from the above-listed pre-defined scripts, GDPR Cookie consent plugin also allows adding a custom script blocker extension whereby the user can explicitly block scripts of their choice. To achieve this simply add the below code snippet to the active child theme function.php.
The above code snippet inserts two new script blockers from Google Translator and Recaptcha. Likewise, you can insert scripts accordingly by entering appropriate values for the array fields id, label, key, category, and status.
- id: key in the name of the script.
- label: enter an appropriate label name for the script blocker that will appear in the interface.
- key: specify any number of unique strings separated with commas that can be used to identify your script(an array of strings).
- category: assign slug of an existing cookie category for the script. If such a category is not existing then you will have to create a new cookie category and assign it’s slug here.
- status: set the status as ‘yes’ to make it active by default else set as ‘no’.
On inserting the above code snippet to the function.php file, the script blocker interface will be as shown below: