Installation

Once you have created your site and published the banner in the dashboard, copy the line shown in the “Installation” tab. It looks like this:

<script src="https://your-server/s/YOUR-SITE-ID.js"></script>

Place it first thing in the <head> of every page, before your other scripts:

<head>
  <meta charset="utf-8">
  <script src="https://your-server/s/YOUR-SITE-ID.js"></script>
  <!-- your other scripts after it -->
</head>

Load the script synchronously, without async or defer: that is what lets it block trackers before they run. It is lightweight and cached by the browser.

The script contains both the banner and your published configuration. When you publish a change in the dashboard, it goes live on your site within a few minutes, without touching the code.

Blocking trackers

Automatic blocking

The services declared under “Cookies & services” are recognised from the address of their scripts and iframes (136 services known in the catalogue). They are held back until the visitor has accepted the matching category, then run without reloading the page. You have nothing to change in your code for Google Analytics, Meta Pixel, Hotjar, LinkedIn, TikTok and the other common tools.

Manual blocking

For a script the catalogue does not know, change its type to text/plain and give its category with data-cm-category:

<!-- Runs only once audience measurement is accepted -->
<script type="text/plain" data-cm-category="analytics"
        src="https://cdn.example.com/tracker.js"></script>

<!-- Also works for an inline script -->
<script type="text/plain" data-cm-category="marketing">
  console.log('marketing accepted');
</script>

The available categories are preferences, analytics and marketing (the necessary category is always on).

Videos and iframes

Replace src with data-cm-src: the iframe is replaced by an explanatory placeholder, with a button to allow it, until the category is accepted.

<iframe data-cm-src="https://www.youtube.com/embed/ID"
        data-cm-category="marketing" data-cm-service="youtube"
        width="560" height="315"></iframe>

“Manage cookies” link

The GDPR requires that visitors can change their choice at any time. In addition to the floating button, add a link to your footer:

<!-- Opens the preference centre -->
<a href="#optooki">Manage cookies</a>

<!-- Or on any element -->
<button type="button" data-cm-open>Manage cookies</button>

<!-- Shows the banner again rather than the preferences -->
<button type="button" data-cm-open="banner">Review the banner</button>

List of cookies

In your cookie policy, an element with the data-cm-cookie-list attribute displays the table of declared services and cookies, by category. It stays up to date with every publication.

<div data-cm-cookie-list></div>

Google Tag Manager and Consent Mode v2

Consent Mode v2 is on by default. The script sends the default state (everything refused) before your Google tags, then the four signals ad_storage, analytics_storage, ad_user_data and ad_personalization with every choice.

With Google Tag Manager, simply place the Optooki script before the container:

<script src="https://your-server/s/YOUR-SITE-ID.js"></script>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){ /* … */ })(window,document,'script','dataLayer','GTM-XXXX');</script>

With every choice, the optooki_consent event is also pushed to the dataLayer, with the state of each category in the optooki variable. Use it as a trigger for tags that do not support Consent Mode.

With the Optooki template for Google Tag Manager

If you cannot edit the site’s code, add the “Optooki - Bandeau de consentement (CMP)” tag from the Google Tag Manager Community Template Gallery. Paste the server URL and the site ID, then choose the “Consent Initialization - All Pages” trigger. The tag sets the default state (everything refused) before all the others, then loads the banner, which passes every choice on to the Google tags.

Loaded by Google Tag Manager, the banner arrives after the scripts written directly into the site’s code, so it cannot block them. It controls the tags in your container (Consent Mode and the optooki_consent trigger). To block the site’s scripts as well, place the Optooki line at the top of the <head> instead.

JavaScript API

The script exposes the window.Optooki object:

Optooki.showPreferences();       // open the preference centre
Optooki.show();                  // show the banner again
Optooki.hasConsent('analytics'); // true or false
Optooki.getConsent();            // { id, choices, action, timestamp… }
Optooki.acceptAll();
Optooki.rejectAll();
Optooki.setConsent({ analytics: true });
Optooki.reset();                 // forget the choice

// React to changes
Optooki.on('consent', (state) => { /* … */ });
window.addEventListener('optooki:consent', (event) => event.detail);

The available events are ready, consent, show and hide.

WordPress

The Optooki plugin adds the script in the right place, blocks common WordPress trackers and shares consent with the WP Consent API. See the plugin page.

PrestaShop

The Optooki module works with PrestaShop 1.7, 8 and 9. In Modules → Module Manager, click “Upload a module” and drop the optooki.zip archive, then open “Configure” and paste the server URL and the site ID, which you will find in the Installation tab of the dashboard. The “Test connection” button checks that everything is in place.

The module places the script at the very top of every page of the shop, holds back Google Analytics, Meta, Hotjar, Clarity, LinkedIn and TikTok as well as YouTube and Vimeo videos on product pages and CMS pages, and adds a “Manage cookies” link to the footer. In a CMS page, [optooki_cookie_list] displays the list of cookies and [optooki_preferences] a button that reopens the preferences.

Joomla

The Optooki plugin works with Joomla 4.4, 5 and 6. Install the plg_system_optooki.zip archive from System → Install → Extensions, then open System → Manage → Plugins, “System - Optooki”: enable it, paste the server URL and the site ID, and test the connection.

The banner is placed at the top of every page of the public site, and Google Analytics, Meta, Hotjar, Clarity, LinkedIn and TikTok scripts as well as YouTube and Vimeo videos are held back until consent is given. In your articles, [optooki_preferences] displays a “Manage cookies” button and [optooki_cookie_list] the list of cookies; in a menu, a URL item pointing to #optooki reopens the preferences.

Drupal

The Optooki module works with Drupal 10.3 and later, and Drupal 11. Unzip optooki.zip into web/modules/custom/, enable the module in Extend, then open Configuration → System → Optooki to paste the server URL and the site ID and test the connection.

The banner is placed at the top of every page of the public site, including pages served from Drupal’s cache, and known trackers as well as YouTube and Vimeo videos are held back until consent is given. Place the “Manage cookies (Optooki)” block in the footer, and use [optooki_preferences] and [optooki_cookie_list] in your content. The interface is also translated into French.

Shopify

The Optooki app asks for no access to the shop’s products, customers or orders. Once it is installed, open Online Store → Themes → Customise → App embeds, turn on “Optooki cookie banner” and paste the server URL and the site ID. In Settings → Customer privacy, turn off Shopify’s own banner so that only one banner is shown.

The banner loads at the start of every page, before the other scripts. The visitor’s choice is passed on to Shopify’s Customer Privacy API: Shopify’s analytics and app pixels (Meta, Google & YouTube, TikTok…) respect it, all the way to checkout. The “Cookie list” and “Manage cookies button” blocks can be added to your pages from the theme editor, and a menu link to #optooki reopens the preferences.

Wix

The Optooki app reads none of the site’s contacts, orders or members. Once it is installed, open Apps → Optooki in the Wix dashboard, paste the server URL and the site ID, test the connection, then turn on the banner. In Settings → Privacy & Cookies, turn off Wix’s own banner so that only one banner is shown.

The site’s domain in Optooki must be the public address of the Wix site: your custom domain, or name.wixsite.com for a free Wix address. The visitor’s choice is passed on to Wix’s consent policy: its analytics, its marketing integrations and the other apps respect it, and nothing is set before the choice is made. A menu link to #optooki reopens the preferences.

Squarespace

Squarespace does not accept an app for this role: the Optooki line goes into the site’s code injection, available from the Core plan (formerly Business) upwards.

  1. Open Website → Website Tools → Code Injection, and paste the Optooki line at the very top of the “Header” field, before any other code.
  2. Save. The banner appears on every published page.
  3. In Squarespace’s cookie settings, turn off its cookie banner so that only one banner is shown.
  4. For the “Manage cookies” link, add a Code block to the footer with <a href="#optooki">Manage cookies</a>.

Squarespace inserts its own scripts before the code injection: its built-in analytics do not go through Optooki. The scanner detects them and adds them to your list of cookies.

Webflow

Custom code requires a paid site plan. Open the site settings, Custom code tab, and paste the Optooki line at the very top of the “Head code” field. Then publish the site: custom code only applies to the published version, not in the Designer.

For the “Manage cookies” link, add a link to the footer whose address is #optooki, or an Embed element containing <button type="button" data-cm-open>Manage cookies</button>. The list of cookies is added the same way, in an Embed, on your cookie policy page: <div data-cm-cookie-list></div>.

YouTube and Vimeo videos added with Webflow’s Video element are iframes: to hold them back until consent is given, use an Embed with data-cm-src instead (see Videos and iframes).

Technical questions

My site uses a Content Security Policy

Allow your Optooki server’s domain in script-src (loading the script) and in connect-src (saving consent records). Nothing needs adding to style-src on current browsers: the banner uses constructed stylesheets, which the CSP does not block, so no 'unsafe-inline' is needed.

If your policy relies on nonces, put the nonce on the banner’s tag (nonce="…", or data-cm-nonce="…" if you cannot set the attribute). It is reused by the scripts the banner re-enables after consent and by the fallback stylesheet for older browsers.

The banner does not show on another address of my site

The banner is only served to the site’s declared domain, its subdomains and its extra domains; only consent records sent from these addresses are saved. Another site that copied your tag therefore gets neither a banner nor consent records, and does not use up your quota. The browser console shows the refused domain.

For a second address of the same site (shop.com alongside shop.fr), a staging site or the preview address of a Shopify store (my-store.myshopify.com), add it under Settings → Extra domains, up to three per site, at no extra cost. Development addresses (localhost, 127.0.0.1, .local, .test) always show the banner, without saving consent records.

I use a caching or optimisation extension

Exclude the Optooki script from the options that defer, delay or combine JavaScript: it must remain the first script on the page.

My site is a single-page application (React, Vue…)

Add the script to the <head> of your main HTML file. The banner stays in place as visitors navigate, and the JavaScript API lets you react to consent.

Sharing the choice across subdomains

In the site settings, enter a cookie domain (for example .example.com): the choice then applies to every subdomain.

Hiding the banner on certain pages

The site settings let you list paths (privacy policy, legal notice) on which the banner does not open automatically.

Your banner, ready before your next coffee.

Create your account, customise the banner and add one line of code. Free for one site, no credit card required.