Installation

Add the Cookient consent banner to your website with a simple HTML snippet.

Overview

Installing Cookient on your website involves adding a small JavaScript snippet to your HTML. There are two installation methods, depending on your needs:

Standard Installation

Quick setup that loads the consent banner. Best for sites that don't need to block third-party scripts before consent.

Script Blocking Mode
Recommended

Full GDPR compliance. Blocks analytics and marketing scripts until the user gives consent. Requires running a cookie scan first.

New to Cookient? Start with the Quickstart guide for a complete walkthrough from registration to installation.

Get Your Snippet

Each domain has a unique installation snippet with its own token. Here's how to find yours:

  1. Go to Domains in your dashboard
  2. Click on the domain you want to install the banner on
  3. Click the "Install Snippet" button
  4. Copy the code snippet from the modal

Domain Token

Your snippet contains a unique token like abc123xyz. This token identifies your domain and loads your specific banner configuration. Keep this token private – it's tied to your account.

Standard Installation

The standard installation uses an async loader that downloads and initializes the consent banner. This method is non-blocking and won't slow down your page.

index.html
<script>
  (function(w,d,s,u,n,e,l){w['CookientObject']=n;w[n]=w[n]||function(){
  (w[n].q=w[n].q||[]).push(arguments)},w[n].l=1*new Date();e=d.createElement(s);
  l=d.getElementsByTagName(s)[0];e.async=1;e.src=u;l.parentNode.insertBefore(e,l)
  })(window,document,'script','https://cookient.app/cdn/banner.js','cookient');
  cookient('init', 'YOUR_DOMAIN_TOKEN');
</script>
+Lightweight async loader (~2KB)
+Non-blocking – doesn't delay page rendering
+Displays consent banner and logs user choices
!Does not block third-party scripts before consent
i
When to Use Standard Installation
Use this method if your site doesn't use analytics or marketing scripts, or if you manage script loading separately (e.g., through Google Tag Manager with Consent Mode).

Script Blocking Mode

For full GDPR compliance, use the CDN-based script that blocks tracking scripts until the user gives consent. This prevents cookies from being set before the user makes a choice.

*
Recommended for GDPR Compliance
Script blocking mode ensures that analytics and marketing cookies are never set without explicit user consent – a core GDPR requirement.
index.html
<script src="https://cookient.app/c/YOUR_DOMAIN_TOKEN.js" data-cookient-cdn></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
  window.cookient && window.cookient.load();
});
</script>
+Blocks scripts before consent is given
+Blocks iframes (YouTube, Maps, social embeds) with placeholder UI
+Removes cookies when consent is withdrawn
+Respects Do Not Track and Global Privacy Control signals

Requirement: Cookie Scan

Script blocking mode requires a completed cookie scan so Cookient knows which scripts to block.

Without a scan, the script won't know which third-party scripts belong to which consent category. Run a scan from the Cookie Management page before enabling blocking mode.

Script Placement

For script blocking to work correctly, the Cookient snippet must be the first script in your <head> tag.

!
Critical: Script Order Matters
If other scripts load before Cookient, they will execute before Cookient can block them. This defeats the purpose of script blocking and may result in GDPR violations.

Correct Placement Example

index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Website</title>

  <!-- Cookient MUST be first -->
  <script src="https://cookient.app/c/YOUR_DOMAIN_TOKEN.js" data-cookient-cdn></script>
  <script>
  document.addEventListener("DOMContentLoaded", function() {
    window.cookient && window.cookient.load();
  });
  </script>

  <!-- Other scripts come AFTER Cookient -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=GA_ID"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'GA_ID');
  </script>

  <!-- CSS and other head elements -->
  <link rel="stylesheet" href="/styles.css">
</head>
<body>
  ...
</body>
</html>

Common Placement Mistakes

XPlacing Cookient after analytics scripts

Analytics will load and set cookies before Cookient can block them.

XPlacing Cookient at the end of the page

All scripts will have already executed by the time Cookient loads.

XLoading Cookient with defer or async

The blocking script must load synchronously to intercept other scripts. Note: The CDN script does not use async for this reason.

Verify Installation

After adding the snippet to your website, verify that it's working correctly.

Using the Dashboard

  1. Go to Domains in your dashboard
  2. Click on your domain
  3. Click "Verify Installation"
  4. Wait for the verification check to complete

Manual Testing

  1. Open your website in an incognito/private browser window
  2. Verify that the consent banner appears
  3. Make a consent choice (accept or reject)
  4. Check the Consent Logs page to confirm the choice was recorded

DevTools Verification

For a deeper check, use your browser's Developer Tools:

Network Tab

Look for requests to cookient.app. You should see the script loading and a config request to fetch your banner settings.

Console Tab

Check for any errors. A successful installation should show no Cookient-related errors.

Application Tab

After making a consent choice, check Local Storage for a cookient_consent key containing your consent preferences.

Troubleshooting

Common installation issues and how to resolve them.

Banner doesn't appear

  • - Check that the snippet is added correctly to your HTML
  • - Ensure the domain token matches your registered domain
  • - Clear your browser cache and cookies, then reload
  • - Check the browser console for JavaScript errors
  • - Ensure your domain is added in the dashboard

Scripts still load before consent

  • - Ensure Cookient is the FIRST script in your <head>
  • - Make sure you're using the blocking mode snippet, not the standard one
  • - Run a cookie scan to detect all scripts that need blocking
  • - Check that the scripts are properly categorized in the Scripts tab

Token not found error

  • - Ensure the domain is added in your dashboard
  • - Check that you copied the full token without extra spaces
  • - Ensure the domain in the token matches your website URL

CSP (Content Security Policy) errors

If your site uses Content Security Policy, add these domains to your policy:

CSP Header
script-src 'self' https://cookient.app;
connect-src 'self' https://cookient.app;

Banner styling issues

  • - Check for CSS conflicts with your site's styles
  • - The banner uses high z-index values – ensure no elements have higher z-index
  • - Test on different browsers and devices
  • - Use the Banner Editor to customize the appearance
*
Still Having Issues?
If you're still experiencing problems, contact support with your domain name and a description of the issue. Include any error messages from the browser console.