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

# getBilyTrackingId()

> Get or create the stable Bily identifier for the current browser.

Use `getBilyTrackingId()` to read the identifier Bily uses for the current browser. The SDK creates one when needed.

## Get the identifier

```typescript theme={null}
function getBilyTrackingId(): string | null;
```

## Correlate it safely

```typescript theme={null}
import { getBilyTrackingId } from "@bilyai/js";

const trackingId = getBilyTrackingId();

if (trackingId) {
  sendSafeCorrelationId(trackingId);
}
```

## Keep it stable in the browser

When browser storage is available, the SDK stores a stable identifier there.

If storage is blocked, the SDK keeps an in-memory identifier for the page session. It can also use an existing Bily identifier when one is available.

Call this method before or after `init()`.

## Handle `null` on the server

During server rendering, the method returns `null`. Always handle the nullable return type.

```typescript theme={null}
const trackingId: string | null = getBilyTrackingId();
```

## Keep authorization separate

The browser tracking ID is not a password, session token, or authenticated account ID. Never use it to authorize a request.

Authorize requests with your own verified session. Use `client.userId` only for approved account context.

<Card title="Client data" icon="user-shield" href="/guides/client-data">
  Separate browser identity, authenticated users, and consent responsibilities.
</Card>
