> ## 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.reset(): Clear user identity and session state

> Attempt to send queued events, clear the stored user ID and traits, and generate new session and anonymous IDs. Call on logout.

Call `Wendung.reset()` when the current user logs out. It attempts to send queued events through [`sendBeacon()`](/api-reference/send-beacon), then clears the stored user ID and traits and generates new session and anonymous IDs. It returns immediately without waiting for the requests to settle.

Queued events keep the identity and session captured when they were recorded, including events re-queued after a failed send. The SDK stays initialized: the flush timer and lifecycle listeners keep running, and subsequent `step()` calls are attributed to a fresh anonymous session.

Throws if called before [`init()`](/api-reference/init).

```typescript theme={null}
Wendung.reset(): void
```

## Parameters

None.

## Returns

`void`

## Examples

### Logout handler

```typescript theme={null}
async function handleLogout() {
  await signOut()
  Wendung.reset()
}
```

### Account switching

```typescript theme={null}
function switchAccount(newUser: User) {
  Wendung.reset()
  Wendung.identify(newUser.id, { email: newUser.email, plan: newUser.plan })
}
```

<Note>
  To wait for a send attempt across the whole queue, call `await Wendung.sendBeacon()` before `reset()`. This does not guarantee delivery: network and server failures are re-queued, while `4xx` responses drop the affected batch. If `fetch` is unavailable, events stay queued.
</Note>


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