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 to Use Google Consent Mode v2 Outside the EEA and the UK](https://images.prismic.io/secure-privacy/Zp5NZh5LeNNTxWk3_HowtoUseGoogleConsentModev2byRegion.png?ixlib=gatsbyFP&auto=format%2Ccompress&fit=max&q=45)
How to Use Google Consent Mode v2 Outside the EEA and the UK
Discover why using Google Consent Mode v2 outside the EEA and the UK might be unnecessary. Learn about compliance requirements, the impact on data collection, and how to optimize your approach based on regional privacy laws.
- Europe GDPR
![The Impact of Special Purpose 3: Latest Amendments to the IAB Transparency and Consent Framework (TCF) V2.2 Policies by IAB Europe](https://images.prismic.io/secure-privacy/ZpUC_R5LeNNTxJ7o_TheImpactofSpecialPurpose3_LatestAmendmentstotheIABTransparencyandConsentFramework-TCF-V2.2PoliciesbyIABEurope.png?ixlib=gatsbyFP&auto=format%2Ccompress&fit=max&q=45)
The Impact of Special Purpose 3: Latest Amendments to the IAB Transparency and Consent Framework (TCF) V2.2 Policies by IAB Europe
Discover how the latest amendments to the IAB Transparency and Consent Framework (TCF) V2.2, particularly the introduction of Special Purpose 3 (SP3), are transforming user consent and transparency in the digital advertising ecosystem. Learn about the new requirements for protecting children's privacy, preventing dark patterns, and ensuring explicit consumer consent.
- Europe GDPR
![Understanding the Difference Between a PIA and DPIA in GDPR Privacy Risk Assessments](https://images.prismic.io/secure-privacy/ZonRuR5LeNNTw2___UnderstandingtheDifferenceBetweenaPIAandDPIAinGDPRPrivacyRiskAssessments.png?ixlib=gatsbyFP&auto=format%2Ccompress&fit=max&q=45)
Understanding the Difference Between a PIA and DPIA in GDPR Privacy Risk Assessments
Learn the key differences between Data Protection Impact Assessments (DPIAs) and Privacy Impact Assessments (PIAs). Understand their importance in ensuring compliance with privacy laws and best practices for mitigating privacy risks.
- Europe GDPR
- Data Protection