# Identify users

> Call atrby.identify() at sign-up and pass the same user id in checkout metadata so later payments are credited to the visit that brought the user.

Canonical: https://atrby.site/docs/identify
Last updated: 2026-10-21

Link a visit to the person who later signs up and pays, without a tracking cookie. One call in your app, one field in your checkout.

## When to use identify

In cookieless mode, atrby recognises a visitor for one day, and the visit ids you pass at checkout only cover the visit where the checkout starts. People often land on Monday, sign up, and pay two weeks later from a bookmark. Without a link between the two, that payment is credited to the later visit, usually Direct.

Call `atrby.identify()` when someone signs up. atrby stores your user id with that visit. When a payment arrives carrying the same id, it's credited to the source of that visit.

**Nothing is stored on the visitor's device.** identify() sends your user id with the current visit and nothing else. No cookie or local storage is written.

## Call identify after sign-up

Put the call where sign-up succeeds, in the browser.

```js
const user = await signUp(form);

// link this visit to the new account
window.atrby?.identify(user.id);
```

If you also call it on later logins, payments are credited to the most recent visit where you called it. To keep credit with the visit that brought the person in, call it once, at sign-up.

## Pass the same id to your checkout

Put your user id in the checkout metadata as `atrby_uid`, next to the visit ids. When the payment webhook arrives, atrby looks up the session first. If that session is unknown or older than 90 days, it uses the user id instead.

```js
const session = await stripe.checkout.sessions.create({
  mode: "subscription",
  line_items: [{ price: "price_growth_monthly", quantity: 1 }],
  metadata: { ...ids, atrby_uid: user.id },
  // renewals carry the subscription's metadata
  subscription_data: { metadata: { ...ids, atrby_uid: user.id } },
});
```

Not on Stripe? The field differs, the idea is the same. Each [integration page](https://atrby.site/docs/integrations/lemon-squeezy) shows where the ids go.

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `userId` | string | Required | Your stable id for this person, such as the database id. Up to 128 characters. Avoid emails: the id is stored as given. |

## Check it worked

1. Sign up on your own site in a private window.
2. Open Sessions in atrby. Your visit's timeline shows an identify step.
3. Make a test purchase with the id in the checkout metadata. The payment shows on the Revenue screen against the source you arrived from.

A payment with neither id, or with ids atrby can't find, is still counted and labelled Unattributed. We never guess.

## Related
- [Events and goals](https://atrby.site/docs/events)
- [Revenue attribution](https://atrby.site/docs/revenue)
- [Script reference](https://atrby.site/docs/tracker)
