# Identify visitors

> Link a visitor to a user of your app so their visits and payments line up.

When a person signs in to your product, tell Reveata who they are. Their earlier anonymous visits stay linked to them, and payments that carry the same user id or email are matched to the right visitor.

```js
reveata('identify', {
  userId: 'user_123', // required: your own stable id
  email: 'ada@example.com', // optional
  name: 'Ada Lovelace', // optional
  plan: 'pro', // anything else is stored as a custom property
});
```

- Call it once after sign-in, or on each page load while the person is signed in.
- `userId` is required; calls without it are ignored.
- Extra keys are stored as custom properties (string values, up to 20).

Identification shows the person’s name on their [visitor profile](https://reveata.com/docs/visitors-and-profiles) in your dashboard. Only identify people when your privacy policy allows it.

## Profile pictures

Anyone can call identify from a browser, so the browser call does not accept a picture: an `image` key is ignored. To show a person’s own picture, identify them from your backend with an API key that has the `identify:write` permission:

```bash
curl -X POST https://reveata.com/api/v1/websites/example.com/identify \
  -H "Authorization: Bearer $REVEATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"visitorId":"k3j9x2m1p0qa","userId":"user_123","image":"https://example.com/avatar.png"}'
```

`image` must be an `https://` URL. People without a picture from your backend get a generated face. Server identify also marks the identity as verified, so payment matching can trust it.

## Getting the visitor id

To pass the visitor to your backend or checkout yourself:

```js
window.reveata.visitorId(); // e.g. "k3j9x2m1p0qa…" or null in cookieless mode
window.reveata.sessionId();
window.reveata.metadata(); // { reveata_visitor_id, reveata_session_id }
```

See [Connect a payment provider](https://reveata.com/docs/connect-a-payment-provider) for where to put these values.
