COOKIES. CONSENT. COMPLIANCE
secure privacy badge logo
June 23, 2019

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.

  1. 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.
  2. On script tags change the attribute 'type' from 'text/javascript' to 'text/plain'.
  3. 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>

Image

What Is Cookie Compliance? A Plain English Guide for Website Owners

Your website uses cookies to track visitors, remember their preferences, and analyze behavior. But did you know those innocent-looking cookies come with serious legal obligations? Most website owners discover this the hard way when they receive compliance warnings or face potential fines.

  • Legal & News
  • Data Protection
  • Cookie Consent
  • Cookie banner
Image

Secure Privacy vs OneTrust: 2025 Comparison Guide

Choosing the wrong consent management platform can cost your business thousands in penalties and implementation headaches. With GDPR, CCPA, and LGPD enforcement intensifying, the stakes have never been higher for Secure Privacy vs OneTrust decisions.

    Image

    Secure Privacy vs Usercentrics: 2025 Comparison Guide

    Choosing between Secure Privacy vs Usercentrics for your consent management needs? Both platforms handle core privacy requirements across GDPR, CCPA, and LGPD, but their approaches to implementation, pricing, and user experience differ significantly. This comparison breaks down the key differences between these two popular consent management platforms. We'll examine setup complexity, pricing transparency, automation capabilities, and agency support to help you determine which solution fits your team's specific needs and growth stage. Whether you're managing a single website or multiple client domains, understanding these platforms' strengths and limitations will guide your decision toward the right privacy compliance solution.