# Consent and privacy (https://www.getfounderhq.com/docs/analytics/concepts/consent-and-privacy)

You decide what FounderHQ may collect, per visitor. The web SDK starts in
`pending` when there is no remembered choice and no explicit
`consent_default`.

| State | What it means | What it sends |
| --- | --- | --- |
| pending | The visitor has not answered yet. | Determined by `cookieless_mode`; cookieless page measurement by default. |
| granted | Storage and durable identity are allowed. | Everything you configured. |
| denied | No storage and no durable identity are allowed. | Determined by `cookieless_mode`; cookieless page measurement by default. |
| off | Collection is switched off completely. | Nothing. |

## Switching states

```ts
founderhq.consent("granted"); // after the visitor accepts
founderhq.consent("denied");  // after the visitor declines
founderhq.optOut();           // total off switch
founderhq.optIn();            // back to granted
founderhq.isOptedOut();       // true only in the off state
```

The choice is remembered in a first-party cookie, so it survives the
next visit. `identify` never changes consent; call `consent("granted")`
after your consent UI reports acceptance.

Set the starting point at init:

- `consent_default: "denied"` — wait for consent before anything is
  stored. Use this if you show a banner.
- `opt_out_by_default: true` — start in the off state.
- `respect_dnt: true` — start in the off state when the browser sends
  Do Not Track.

## Cookieless modes

Choose the behavior locally with `cookieless_mode`. Remote config never
changes this choice.

| Mode | Pending | Granted | Denied |
| --- | --- | --- | --- |
| `"off"` | nothing | normal | nothing |
| `"always"` | cookieless | cookieless | cookieless |
| `"when_not_granted"` (default) | cookieless | normal | cookieless |
| `"on_reject"` | nothing | normal | cookieless |

`optOut()` is a hard off switch regardless of mode. Cookieless measurement is
web only; mobile and server SDKs do not implement this mode.

A cookieless visitor sends two events and nothing else:
`$pageview` and `$pageleave`. Those events carry only the shared
`$founderhq_cookieless` sentinel, with no visitor-specific ID, session, or
person properties. The property list is fixed:

- `$pathname`, `$referring_domain`, `$lib`, `$lib_version`,
  `$platform`, and the five `utm_*` keys
- on `$pageleave` only: `$page_duration_ms`,
  `$max_scroll_percentage`, `$leave_reason`

Cookieless traffic gives you honest page counts. It does not give you
contacts, returning visitors, funnels, revenue attribution, or custom
events. Those need a granted visitor.

## What no SDK ever collects

No FounderHQ SDK collects advertising IDs (IDFA or GAID), the device
contact list, arbitrary page text, input values, DOM snapshots, console
logs, network bodies, or native view trees.

You control the rest:

- `redactUrlParams` strips query parameters before they leave the page.
- `beforeSend` gives you the final say on every event; return `null` to
  drop it.
- `reset()` clears the identity on the device, for sign-out.

The consent choice lives on the device. A returning visitor keeps the
answer they gave until they clear their browser storage.

## Related

- [Web SDK](/analytics/sdks/web)
- [Identity and contacts](/analytics/concepts/identity-and-contacts)
- [Bot traffic policy](/analytics/concepts/bot-traffic-policy)
