> ## Documentation Index
> Fetch the complete documentation index at: https://www.pagent.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Cookiebot

> Pass your visitors' Cookiebot consent to pagent.

pagent loads early and reacts to your visitors' consent: it reports pseudonymous data before consent and stores its persistent cookies only after an **opt-in**. Two cookies are set without it: `_pgnt-seed`, which keeps test groups stable for a day, and `_pgnt-opt-in`, which stores the visitor's choice. List them in your cookie declaration. Your cookie banner tells pagent about the visitor's choice through two commands. See the [consent guide](https://www.pagent.ai/docs/guides/integration/consent.md) for how pagent handles consent, including the strict option that holds back all data until opt-in.

## 1. Keep Cookiebot from blocking pagent

With Cookiebot's automatic blocking, mark the pagent snippet with `data-cookieconsent="ignore"`, so it loads before the page shows. pagent then follows the visitor's choice from step 2.

```html theme={"dark"}
<script
  data-cookieconsent="ignore"
  src="https://cdn.pagent.ai/js/sdk.js"
  data-client-key="YOUR_CLIENT_KEY">
</script>
```

Keep the Cookiebot script itself first in `<head>`, as Cookiebot requires.

## 2. Pass the consent to pagent

Add this script after the pagent snippet. It sends `opt-in` when the visitor accepts **statistics** cookies, and `opt-out` otherwise, on every page load and whenever the visitor changes their choice:

```html theme={"dark"}
<script data-cookieconsent="ignore">
  (function () {
    window._pgnt = window._pgnt || [];

    function sendConsent() {
      if (!window.Cookiebot || !window.Cookiebot.consent) return;
      window._pgnt.push({ kind: window.Cookiebot.consent.statistics ? "opt-in" : "opt-out" });
    }

    ["CookiebotOnConsentReady", "CookiebotOnAccept", "CookiebotOnDecline"].forEach(function (name) {
      window.addEventListener(name, sendConsent);
    });

    // Cookiebot may already know the choice when this runs.
    if (window.Cookiebot && window.Cookiebot.hasResponse) sendConsent();
  })();
</script>
```

Prefer another category? Replace `statistics` with `marketing` or `preferences`, to match how you describe pagent in your cookie declaration.

## Check it worked

1. Open your site in a private window and accept statistics cookies.
2. In your browser's developer tools, check that pagent's cookies starting with `_pgnt` appear.
3. Open **Cookiebot → Change your consent**, decline statistics, and check that they're removed again, except `_pgnt-seed` and `_pgnt-opt-in`, which now reads `false`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.