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

# User tracking

> Associate sessions and problems with signed-in users.

For Next.js, Vite + React, and TanStack Start, call `identity.set()` after your app loads its authenticated user. Interfere attaches the identity to the session so you can find the person in [Users](/docs/product/users.md) and see the problems affecting them.

## Sync the signed-in user

Render `SyncIdentity` inside `InterfereProvider` and pass the user from your authentication system. Choose the example for your framework:

```tsx Next.js theme={null}
"use client";

import { useInterfere } from "@interfere/next/provider";
import { useEffect } from "react";

type User = {
  id: string;
  name: string;
  email: string;
};

export function SyncIdentity({ user }: { user: User | null }) {
  const { identity } = useInterfere();

  useEffect(() => {
    if (!user) {
      identity.clear();
      return;
    }
    identity.set({
      identifier: user.id,
      name: user.name,
      email: user.email,
      source: { type: "custom", name: "Acme" },
    });
  }, [identity, user]);

  return null;
}
```

```tsx Vite / TanStack Start theme={null}
import { useInterfere } from "@interfere/vite/provider";
import { useEffect } from "react";

type User = {
  id: string;
  name: string;
  email: string;
};

export function SyncIdentity({ user }: { user: User | null }) {
  const { identity } = useInterfere();

  useEffect(() => {
    if (!user) {
      identity.clear();
      return;
    }
    identity.set({
      identifier: user.id,
      name: user.name,
      email: user.email,
      source: { type: "custom", name: "Acme" },
    });
  }, [identity, user]);

  return null;
}
```

Use a stable internal user ID for `identifier`. An email can change, so it should not be the identifier.

## Identity fields

| Field | Purpose |
| - | - |
| `identifier` | Required stable user ID |
| `source` | Required provider type and display name |
| `name` | Display name |
| `email` | Email address |
| `avatar` | Avatar URL |
| `traits` | Additional user properties |

Set `source.type` to `clerk`, `auth0`, or `custom`. Set `source.name` to the provider's display name.

Wait until your authentication system has loaded before rendering `SyncIdentity`. Pass `null` after sign-out to clear identity and start a new anonymous session. Identity calls are deduplicated per session. Read the current session ID with `useSession` from your framework's provider package.


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