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>
How CMPs Can Help You Manage Multi-Language Consent Effectively
Learn how to manage consent across multiple languages, ensure global privacy compliance, and build trust with international users using a Consent Management Platform.
- Legal & News
Comprehensive Guide to Integrating a Consent Management Platform (CMP) on Your Website
Learn how to select and set up a Consent Management Platform (CMP) for your website. Ensure GDPR & CCPA compliance while integrating with Google Analytics & WordPress.
- Legal & News
Google Consent Mode: Technical Setup and Best Practices for Implementation
Learn how to implement Google Consent Mode, understand its features, and optimize tag behavior based on user consent states for Analytics and Ads tracking.
- Legal & News