# Consent

> How Numbat reads consent from your consent tool, and how to set it yourself.

Numbat tracks consent on four axes: `analytics`, `ad_user_data`,
`ad_personalization` and `identity`. Each starts as granted and changes
only when your site or its consent tool says otherwise. For what the axes
mean for ad platforms, see
[Consent and emission](/docs/conversions/consent-and-emission).

- When `analytics` is denied, the script holds no visitor identity on the
  device.
- When `identity` is denied, the script captures no email, phone or name,
  and the `identify` call does nothing.

## Google Consent Mode

If your site runs Google Consent Mode v2, Numbat reads it from
`dataLayer`. There is nothing to configure.

| Consent Mode key | Numbat axis |
|---|---|
| `analytics_storage` | `analytics` |
| `ad_user_data` | `ad_user_data` |
| `ad_personalization` | `ad_personalization` |
| `ad_storage` | `identity` |

- A consent `update` applies everywhere.
- A consent `default`, fired before the visitor answers the banner,
  applies only where consent is required. Elsewhere it is ignored, and
  the visitor's answer applies as an update.
- A visitor who never answers keeps the default where consent is
  required, and is tracked as granted elsewhere.

## Cookiebot and CookieYes

Numbat reads the Cookiebot or CookieYes cookie directly. There is nothing
to configure.

| Category | Sets |
|---|---|
| Cookiebot `statistics`, CookieYes `analytics` | `analytics` |
| Cookiebot `marketing`, CookieYes `advertisement` | `ad_user_data`, `ad_personalization` and `identity` |

A visitor who refuses marketing cookies is also not identified. A missing
or unreadable cookie changes nothing.

OneTrust is not read, because its cookie records category ids, not names.
For OneTrust or any other tool, call Numbat yourself as below.

## Other consent tools

Call `numbat("consent", ...)` when the visitor answers. Calls made before
the tag loads are queued and run when it does.

```js
// All four axes at once.
numbat("consent", "granted");
numbat("consent", "denied");

// Only the axes you name. Others keep their current value.
numbat("consent", { analytics: true, ad_user_data: false });
```

A key whose value is not `true` or `false` is ignored. Your call also
replaces any pending Consent Mode default for the axes it names.

## Related

- [Consent and emission](/docs/conversions/consent-and-emission)
- [JavaScript API](/docs/tracking/javascript-api)
