GDPRChecker

Home / Knowledge Base / How to Exclude CookieYes Script from SG Optimizer Plugin: A Practical Compliance Guide

Website Compliance

How to Exclude CookieYes Script from SG Optimizer Plugin: A Practical Compliance Guide

A practical guide for website owners on excluding the CookieYes consent script from SG Optimizer's JavaScript optimizations to prevent pre-consent tracking and close GDPR consent gaps. Covers step-by-step implementation, common mistakes, scanner validation with GDPRChecker, and a detailed checklist.

Author

GDPRChecker Editorial Team

Reviewed by

Privacy & Compliance Research Team

Last updated

August 2026

Reading time

12 min read

Educational guidance for compliance readiness — not legal advice. Requirements vary by jurisdiction and your specific processing activities.

Introduction

*Updated for 2026 compliance practices.*

If you run a WordPress site with SiteGround’s SG Optimizer plugin and use CookieYes for consent management, you may have noticed a common but critical issue: the CookieYes script gets combined, minified, or deferred by SG Optimizer’s frontend optimizations. This can break your cookie banner, delay consent signals, and create a **consent gap**—where trackers fire before the visitor has given consent. Excluding the CookieYes script from SG Optimizer is a practical step to close that gap and keep your site’s compliance posture verifiable.

This guide explains what “exclude cookieyes script from sg optimizer plugin” means for website owners, why it matters for GDPR compliance, and how to implement the exclusion correctly. We’ll walk through step‑by‑step instructions, common mistakes, and how to validate your setup with **GDPRChecker’s scanner** to ensure no pre‑consent network requests slip through. Remember, this is a technical implementation guide, not legal advice. Always consult a qualified privacy professional for legal obligations.

What Is “Exclude CookieYes Script from SG Optimizer Plugin”?

SG Optimizer is a performance plugin that speeds up WordPress sites through caching, file combination, minification, and deferred loading of JavaScript. While these optimizations improve Core Web Vitals, they can interfere with consent management scripts like CookieYes. When the CookieYes script is combined or deferred, it may load too late—or not at all—allowing marketing and analytics tags to fire before the visitor’s consent choice is recorded.

**Excluding the CookieYes script** means telling SG Optimizer to leave that specific JavaScript file untouched: no minification, no combination, no deferral. This ensures the script loads early, in its original form, so the consent banner appears immediately and consent signals are available before any other tags execute. For GDPR compliance, this is essential because the ePrivacy Directive and GDPR require that non‑essential cookies and trackers are not set until after the user has given unambiguous consent.

From a technical standpoint, you’re creating an exclusion rule for the CookieYes script URL (typically `https://cdn-cookieyes.com/client_data/...`) within SG Optimizer’s settings. This rule overrides the global optimization settings for that single resource.

Why Excluding CookieYes from SG Optimizer Matters for GDPR Compliance

Under the GDPR and ePrivacy Directive, websites must obtain prior consent before storing or accessing information on a user’s device, unless the cookie is strictly necessary. Consent must be freely given, specific, informed, and unambiguous. This means your cookie banner must load before any tracking scripts, and those scripts must be blocked until the user makes a choice.

When SG Optimizer defers or combines the CookieYes script, several compliance problems can arise:

  • **Delayed banner**: The consent banner appears late, and in the meantime, analytics or advertising tags may already have fired.
  • **Broken consent signals**: Google Consent Mode v2 relies on the CMP script to set default consent states. If the script is delayed, the defaults may not be applied, causing Google tags to assume consent.
  • **Pre‑consent network requests**: Even if the banner eventually appears, trackers that load early will have already sent data to third parties—a clear violation of the “prior consent” principle.

Regulators, including the European Data Protection Board (EDPB), have emphasized that consent must be obtained before processing begins. A technical misconfiguration that allows pre‑consent tracking can lead to complaints, fines, and loss of user trust. Excluding the CookieYes script from SG Optimizer is a straightforward fix that directly addresses this risk.

Step‑by‑Step: How to Exclude CookieYes Script from SG Optimizer

Follow these steps to exclude the CookieYes script from SG Optimizer’s optimizations. The exact interface may vary slightly depending on your SG Optimizer version, but the principles remain the same.

1. Locate Your CookieYes Script URL

First, identify the exact script URL that CookieYes uses on your site. You can find it by:

  • Checking your CookieYes dashboard under **Installation** > **Script**.
  • Viewing the page source of your website and searching for `cookieyes`.
  • Using browser developer tools (Network tab) and filtering for `cookieyes`.

The URL typically looks like: `https://cdn-cookieyes.com/client_data/xxxxxxxxxxxxxxxxxxxx.js`

Copy this full URL; you’ll need it for the exclusion rule.

2. Access SG Optimizer Settings

In your WordPress admin, go to **SG Optimizer** > **Frontend Optimization**.

3. Exclude from JavaScript Minification

  • Under the **JavaScript** tab, find the **Minify JavaScript Files** option.
  • If enabled, look for the **Exclude from JavaScript Minification** field.
  • Paste the CookieYes script URL into this field.
  • Save changes.

4. Exclude from JavaScript Combination

  • In the same **JavaScript** tab, locate **Combine JavaScript Files**.
  • If enabled, find the **Exclude from JavaScript Combination** field.
  • Add the CookieYes script URL here as well.
  • Save changes.

5. Exclude from Deferral

  • Still under **JavaScript**, find **Defer Render‑blocking JavaScript**.
  • If enabled, add the CookieYes script URL to the **Exclude from Deferral of Render‑blocking JS** field.
  • Save changes.

6. Purge All Caches

After saving, go to **SG Optimizer** > **Caching** and click **Purge SG Cache**. This ensures the new exclusion rules take effect immediately.

7. Test the Exclusion

Open your website in an incognito window and verify:

  • The CookieYes banner appears immediately on page load.
  • In the Network tab, the CookieYes script loads early and is not combined with other JS files.
  • No marketing or analytics tags fire before you interact with the banner.

Common Mistakes When Excluding CookieYes from SG Optimizer

Even with the right intentions, website owners often make mistakes that undermine the exclusion. Here are the most frequent pitfalls and how to avoid them.

**1. Excluding only from minification, not combination or deferral** SG Optimizer’s optimizations work independently. If you exclude from minification but leave combination enabled, the script may still be merged with others and delayed. Always exclude from all three: minification, combination, and deferral.

**2. Using the wrong script URL** CookieYes may load multiple scripts (e.g., for the banner, for the settings panel). Ensure you exclude the main banner script. If you use Google Consent Mode, you may also need to exclude the CookieYes GCM script. Check your CookieYes dashboard for all relevant URLs.

**3. Forgetting to purge cache** SG Optimizer caches aggressively. Even after saving exclusions, the old cached version may still be served. Always purge the SG Cache and any other caching layers (CDN, browser cache).

**4. Assuming the exclusion works without testing** Visual inspection isn’t enough. Use a scanner like **GDPRChecker** to detect pre‑consent network requests, verify banner behavior, and confirm that consent signals are set correctly before tags fire.

**5. Ignoring other optimization plugins** If you use additional caching or performance plugins (e.g., WP Rocket, Autoptimize), they may also affect the CookieYes script. Coordinate exclusions across all active optimization tools.

How to Validate Your Setup with GDPRChecker

After excluding the CookieYes script from SG Optimizer, you must verify that the fix actually closes the consent gap. GDPRChecker’s public compliance scanner automates this validation.

**Step 1: Run a pre‑scan** Before making changes, scan your site with GDPRChecker to establish a baseline. Note any pre‑consent requests, missing banner, or consent mode issues.

**Step 2: Apply the exclusions** Follow the step‑by‑step instructions above and purge all caches.

**Step 3: Run a post‑scan** Immediately after applying exclusions, run another GDPRChecker scan. Compare the results:

  • **Pre‑consent requests**: Should drop to zero for non‑essential cookies.
  • **Banner detection**: The scanner should detect the CookieYes banner and its correct behavior.
  • **Consent Mode diagnostics**: If using Google Consent Mode, GDPRChecker checks that default consent states are set before Google tags load.

**Step 4: Schedule recurring scans** Compliance isn’t a one‑time task. Plugins update, configurations drift, and new tags are added. GDPRChecker’s paid plans offer scheduled monitoring and alerts, so you’re notified if a pre‑consent request reappears.

For a deeper dive into consent verification, see our guide on improving your GDPR compliance score from 42 to 91.

Implementation Checklist: Exclude CookieYes Script from SG Optimizer

Use this checklist to ensure you’ve covered every step.

  1. Locate the exact CookieYes script URL from your dashboard or page source.
  2. In SG Optimizer > Frontend > JavaScript, exclude the URL from **Minify JavaScript Files**.
  3. In the same section, exclude the URL from **Combine JavaScript Files**.
  4. Exclude the URL from **Defer Render‑blocking JavaScript**.
  5. If using Google Consent Mode, identify and exclude any additional CookieYes GCM script.
  6. Save all changes and purge the SG Cache.
  7. Purge any other caches (CDN, browser, third‑party caching plugins).
  8. Run a GDPRChecker scan to verify zero pre‑consent requests and correct banner behavior.
  9. Test the reject flow: click “Reject All” and confirm no tracking cookies are set.
  10. Document the exclusion settings and scan results for your records.
  11. Schedule recurring GDPRChecker scans to catch future regressions.
  12. Review exclusions after any SG Optimizer or CookieYes plugin update.

FAQ

What is “exclude cookieyes script from sg optimizer plugin”? It’s the process of telling SG Optimizer not to minify, combine, or defer the CookieYes consent script. This ensures the cookie banner loads immediately and consent signals are set before any tracking scripts fire, closing a common GDPR consent gap.

Do I need to exclude CookieYes script from SG Optimizer for GDPR? Yes, if you use both plugins. SG Optimizer’s optimizations can delay or break the CookieYes script, causing trackers to fire before consent—a violation of GDPR’s prior consent requirement. Exclusion is a practical fix.

How do I implement the exclusion? In SG Optimizer’s Frontend Optimization settings, add the CookieYes script URL to the exclusion fields for JavaScript minification, combination, and deferral. Then purge all caches and test with a scanner like GDPRChecker.

How can I verify the exclusion with a scanner? Run a GDPRChecker scan before and after applying exclusions. The scanner checks for pre‑consent network requests, banner detection, and consent mode defaults. A successful exclusion should show zero pre‑consent requests.

What are common mistakes when excluding CookieYes from SG Optimizer? Common mistakes include excluding only from minification, using the wrong script URL, forgetting to purge caches, not testing with a scanner, and ignoring other optimization plugins that may also defer the script.

Which cookies and trackers should I check after exclusion? Focus on non‑essential cookies like Google Analytics, Facebook Pixel, LinkedIn Insight Tag, and any advertising trackers. GDPRChecker’s scan will list all detected cookies and highlight those that fired before consent.

How often should I review the exclusion settings? Review after any update to SG Optimizer, CookieYes, or your theme. Also review when you add new tracking tags. Schedule monthly GDPRChecker scans to catch regressions automatically.

What evidence should I keep for compliance? Keep records of your exclusion settings, cache purge logs, and GDPRChecker scan reports showing zero pre‑consent requests. This documentation demonstrates your technical measures to obtain prior consent.

Practical examples

Example 1: A small ecommerce site

A shop changes its cookie banner wording before a seasonal campaign. The operator records the previous and new banner version, tests Reject all and Accept all, and stores screenshots plus the resulting network checks. That creates a clear before-and-after record without relying on memory.

Example 2: A B2B lead-generation site

A marketing team adds a form analytics tag through its tag manager. Before publishing, it documents the consent category, the tag trigger, the privacy notice update, and a test showing that the request does not fire after a visitor rejects optional cookies.

Example 3: A multi-page content site

An editor notices that a new embedded video adds a third-party request. The team scans the affected pages, compares the result with the last scan, updates the cookie disclosure if necessary, and keeps the scan report with the deployment reference.

Article schema

```json { "@context": "https://schema.org", "@type": "Article", "headline": "How to Exclude CookieYes Script from SG Optimizer Plugin: A Practical Compliance Guide", "description": "Learn how to exclude CookieYes script from SG Optimizer plugin to fix consent gaps and improve GDPR compliance. Step-by-step guide with scanner validation and checklist.", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://www.gdprchecker.online/guides/exclude-cookieyes-script-from-sg-optimizer-plugin" }, "publisher": { "@type": "Organization", "name": "GDPRChecker", "url": "https://www.gdprchecker.online" } } ```

GDPRChecker guides are educational resources and do not constitute legal advice. Use them to understand technical and operational privacy requirements, and consult qualified counsel for legal interpretation.

Check Your Website in Under 60 Seconds

  • No signup required
  • GDPR-focused checks
  • Cookie banner detection
  • Privacy policy verification