# Nvivio and your cookie banner

> Whether Nvivio belongs in your cookie banner, how to let it load without consent, and how to connect your banner to Nvivio in cookie mode.

Whether you need a cookie banner at all depends on your country and on the other tools on your site; [Do I need a cookie banner?](https://nvivio.com/legal/cookie-banner) explains the rules country by country. This page is about Nvivio's place in a banner you already have.

## Without cookies (the default)

Nvivio sets no cookie and stores nothing on your visitor's device, so there is nothing to ask consent for ([Privacy and GDPR](https://nvivio.com/docs/privacy#without-cookies-the-default)).

- **Do not list Nvivio under the cookies that wait for consent.** Many banners (Cookiebot, CookieYes, Complianz and others) can hold back scripts until the visitor agrees. If Nvivio is held back, every visitor who declines or ignores the banner is missing from your numbers, while Nvivio could count them without a cookie.
- **Does your banner block every script it does not know?** Mark Nvivio's line (`https://nviv.io/js/…`) as necessary or exempt, so it loads before consent. In Google Tag Manager, give the Nvivio tag no consent requirement ([Consent](https://nvivio.com/docs/google-tag-manager#consent)).
- **Mention Nvivio in your privacy notice.** The [cookie banner page](https://nvivio.com/legal/cookie-banner) has a text you can use, and the [objection box](https://nvivio.com/docs/privacy#visitors-can-object) lets visitors opt out on that page.

## In cookie mode

[With one cookie](https://nvivio.com/docs/privacy#with-one-cookie-optional), Nvivio sets one first-party cookie, `_nvivio_sid`, but only after your page calls `nvivio.consent()`. Until then the visitor is counted as in privacy mode, so the script should load before consent; only the cookie waits.

Call `nvivio.consent()` where your banner reports consent for statistics or analytics. Banners often report it before Nvivio's script has run, so add the [queue for early calls](https://nvivio.com/docs/script#early-calls) above the script line:

```html
<script>window.nvivio=window.nvivio||{q:[],track:function(n,p){this.q.push([n,p])},consent:function(){this.c=1}}</script>
<script defer src="https://nviv.io/js/NV-XXXXXXX.js"></script>
```

For example with Cookiebot, which fires `CookiebotOnAccept` when a visitor accepts and on every page after that:

```html
<script>
  window.addEventListener('CookiebotOnAccept', function () {
    if (Cookiebot.consent.statistics) window.nvivio.consent();
  });
</script>
```

Other banners have a similar event or callback; look for "on consent" or "statistics" in their documentation. In Google Tag Manager, the Nvivio template can follow Consent Mode's `analytics_storage` instead ([Consent](https://nvivio.com/docs/google-tag-manager#consent)).

**When a visitor withdraws consent,** let your banner delete the `_nvivio_sid` cookie (it is set on your main domain, such as `example.com`). From the next page on, the visitor is counted as in privacy mode again. Most banners can delete cookies by name when consent is withdrawn.

## Visitors who object

A visitor who unticks the [objection box](https://nvivio.com/docs/privacy#visitors-can-object) is never counted, in either mode, and consent through your banner never overrides that. A browser that sends Global Privacy Control is never counted either.
