Features Pricing Documentation Blog For agencies Contact
Sign in Try for free
Dokumentácia / Migrácia na Consent Mode v2

Migrácia na nový skript Cookienovo

We've improved our Cookienovo implementation to ensure full compliance with Google Consent Mode v2 and prevent cookies from being set before user consent. This guide will help you update from the old single-script format to the new two-part installation.

Why Update?

The old implementation could allow Google Analytics and other tracking services to set cookies before consent if those services loaded asynchronously. The new implementation uses an inline script to set consent defaults before any tracking services can load, ensuring full compliance with GDPR, ePrivacy Directive, and Google Consent Mode v2 requirements.

Benefits of Updating

  • Full Compliance: Prevents cookies from being set before user consent, even with async-loaded Google tags.
  • Google Consent Mode v2: Includes all required parameters (ad_personalization, ad_user_data) for March 2024 compliance.
  • Better Performance: Use defer attribute on main script for faster page loads without compromising compliance.
  • Industry Standard: Follows the same approach as Cookiebot, CookieHub, and other leading consent management platforms.

Old Implementation (Still Works)

If you're currently using the single-script format below, it still works but may not prevent cookies if Google tags load asynchronously:

<!-- Starý jednoskript (stále funguje) -->
<script site-token="YOUR_TOKEN" src="https://cookienovo.com/assets/client.js"></script>

New Implementation (Recommended)

The new two-part installation ensures consent defaults are set before any Google tags can fire. It also supports the defer attribute for better performance:

Možnosť A: jednoduchá (náš pripravený skript)

<!-- Krok 1: predvolené súhlasy (pripravené) -->
<script src="https://cookienovo.com/assets/cmp.js"></script>

<!-- Krok 2: banner (možno použiť defer) -->
<script site-token="YOUR_TOKEN" src="https://cookienovo.com/assets/client.js" defer></script>

Možnosť B: vlastná (inline, ~300 bajtov, plná kontrola)

<!-- Krok 1: predvolené súhlasy (inline) -->
<script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
gtag('consent','default',{'ad_storage':'denied','ad_personalization':'denied','ad_user_data':'denied','analytics_storage':'denied','functionality_storage':'denied','personalization_storage':'denied','security_storage':'granted','wait_for_update':500});
gtag('set','ads_data_redaction',true);
</script>

<!-- Krok 2: banner (možno použiť defer) -->
<script site-token="YOUR_TOKEN" src="https://cookienovo.com/assets/client.js" defer></script>

Migration Steps

Step 1: Locate your current Cookienovo script tag in your website's <head> section.

Step 2: Replace it with the new two-part script shown above. Make sure to keep your site-token attribute unchanged.

Step 3: Ensure both scripts are placed before any Google tags (Google Analytics, Google Tag Manager, Google Ads, etc.).

Step 4: Test your implementation using the browser console debug function: window.cookienovoDebug.testConsentModeImplementation()

For Google Tag Manager Users

If you're loading Cookienovo via Google Tag Manager, use the GTM-specific script format that includes the inline consent defaults:

<!-- Krok 1: predvolené súhlasy -->
<script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
gtag('consent','default',{'ad_storage':'denied','ad_personalization':'denied','ad_user_data':'denied','analytics_storage':'denied','functionality_storage':'denied','personalization_storage':'denied','security_storage':'granted','wait_for_update':500});
gtag('set','ads_data_redaction',true);
</script>

<!-- Krok 2: načítanie banneru cez GTM -->
<script>
var script = document.createElement('script');
script.setAttribute('site-token', 'YOUR_TOKEN');
script.setAttribute('src', 'https://cookienovo.com/assets/client.js');
script.setAttribute('injected', 'true');
document.getElementsByTagName('head')[0].appendChild(script);
</script>

Verification

After updating your script tags, verify the implementation is working correctly:

// otvorte konzolu prehliadača a spustite:
window.cookienovoDebug.testConsentModeImplementation()

Important Notes

  • Backward Compatible: The old script format still works, but updating is recommended for optimal compliance.
  • Performance: The inline script is only ~300 bytes and loads synchronously. The main banner script can use defer for better page load performance.
  • No Backend Changes: You only need to update the HTML script tags. No database or configuration changes required.

Need Help? If you need assistance with the migration, please contact our support team. We're here to help ensure your implementation is fully compliant and working correctly.