How to block cookies and trackers with JavaScript rewrite
This guide explains you how to block cookies and plugins with Secure Privacy using Javascript rewrite.
To block cookies and trackers you need to change the attributes of the script tags on your website. Follow these steps to change the attributes.
- Apply the attribute sp-consent="PLUGIN NAME" to the script/image tags on your website. Depending on where you have installed the plugins, this may be inside a module, plugin or directly on your website. Make sure that you write the exact plugin name, which appears on your Scan Report.
- On script tags change the attribute 'type' from 'text/javascript' to 'text/plain'.
- If you are using a pixel tracker (image trackers), then change the attribute “src” from “src” to “data-src”.
Here is an example of how it would look after you have modified a Google Analytics script.
Normal script tags look like this:
<script type="text/javascript"> code…
</script>
Using script type re-writing, you need to change the scripts to:
<script type="text/plain" sp-consent="Google Analytics"> code…
</script>

Google Consent Mode & GA4: What Your CMP Needs to Handle in 2025
Your Google Analytics 4 data might be incomplete or non-compliant if your consent management platform isn't properly integrated with Google Consent Mode v2.
- Legal & News
- Integrations

CMP vs Cookie Banner: What's the Real Difference?
Your website's simple cookie banner might be creating a false sense of compliance while exposing your business to massive legal risks. If you think clicking "Accept" on a basic popup satisfies GDPR requirements, you're probably wrong — and regulators are getting increasingly aggressive about enforcing the difference.
- Legal & News
- Data Protection

How to Create a Cookie Policy for Your Website (With Examples)
Your website is probably using more cookies than you realize, and each one could be a compliance violation if not properly disclosed. If you're still operating without a comprehensive cookie policy or relying on generic templates from 2018, you're exposing your business to fines while confusing users.
- Legal & News
- Data Protection
- Cookie banner
- Website Cookies and Tracking