The GDPR Cookie Consent plugin allows you to block the scripts (that inject cookies) that are active on the website until the users give their explicit consent by clicking on the Accept button. The scripts will not be rendered on the website if users ignore the cookie bar or click on the Reject button thereby denying the consent to the use of the cookies on the website.
Refer to the article How to Automatically Block Cookies Using the GDPR Cookie Consent Plugin to know more about it.
In this article, we will show you how to make sure that a cookie script has actually been blocked. We will explain this in relation to our automatic script blocker. Nevertheless, you can use the same approach for scripts rendered via any other third-party plugins or themes or even manually add via the GDPR Cookie Consent Plugin.
Steps to Check if a Cookie Script is Blocked
For instance, let us go through the steps that block the Google Tag Manager script from rendering on the website.
- Navigate to GDPR Cookie Consent plugin > Script Blocker.
- Enable Google Tag Manager from the Manage Script blocker list.
- Load your website(in an incognito mode/private window) without providing any consent.
- Right-click, view the page source and search for Google Tag Manager script. You can see that the script type value is “text/plain” which makes the script to behave like a text content without getting rendered in the website.
- Now, go to your website and accept the cookie.
- Refresh and inspect the page (⇧+⌘+C). Beneath the elements tab, you can see the script type of Google Tag Manager has been updated from “text/plain” to “text/javascript” indicating that the script has been rendered on your site.
The above steps are demonstrated below:
This way you can check if the cookies are being blocked or not to ensure your website’s compliance with GDPR for the usage of cookies.
Comments (2)
Mitch Feldman
December 20, 2019
I followed these steps, and was able to confirm the <script type="text/plain" result for the first four steps. When I did steps 5 and 6, the Script type did not change to <script type="text/javascript".
I have the plugin set up with both the Reject and Accept button shortcodes active in the pop up. Clicking the Accept Button did not change the Script from plan to javascript. Any thoughts on what might be causing the issue would be appreciated. Thank you in advanced.
Mark
December 21, 2019
Hi,
Please reach us via support with the site URL.