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

# Wendung.getConsent(): Read the current analytics consent state

> Return the consent state set by init() or the latest setConsent() call, for settings toggles and debugging.

`Wendung.getConsent()` returns the state passed to [`init()`](/api-reference/init) or the latest [`setConsent()`](/api-reference/set-consent) call. It does not read browser storage or your consent manager; it reports what the SDK is doing right now.

Returns `granted` before `init()` is called, which is the default state.

```typescript theme={null}
Wendung.getConsent(): ConsentState
```

## Parameters

None.

## Returns

`'pending' | 'granted' | 'denied'`

## Examples

### A settings toggle

```typescript theme={null}
toggle.checked = Wendung.getConsent() === 'granted'
```

### Flushing queued events

```typescript theme={null}
await Wendung.flush()
```

No consent guard is needed. With `trackPageviews: 'auto'`, `flush()` can send aggregate pageviews while pending. With no active collection, it does nothing.


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