Identify Users
Associate anonymous visitors with authenticated users using ripples.identify().
Note: Identifying users stores the user ID in localStorage. Once identified, all subsequent events (including pageviews) will include the user ID until the storage is cleared.
ripples.identify()
Call this method after a user logs in or signs up:
ripples.identify({
id: "user_123", // required
email: "[email protected]", // optional
name: "Jane Doe", // optional
avatar_url: "https://...", // optional
signed_up_at: "2026-01-15T...", // optional — ISO 8601 date string
plan: "pro", // optional
})
Call on every authenticated page load — not just on login. It's safe to call multiple times and ensures the user stays linked across page navigations and sessions.
Parameters
| Parameter | Type | Description |
|---|---|---|
props required |
object |
User properties object. Must include id. |
Properties object
| Key | Type | Description |
|---|---|---|
id required |
string |
Your internal user ID. This links anonymous sessions to the user. |
email optional |
string |
User's email address. Shown in the visitor profile. |
name optional |
string |
Display name. Shown in the visitor profile instead of the anonymous name. |
avatar_url optional |
string |
URL to the user's avatar image. Also accepts avatar as an alias. Shown in the visitor profile. |
signed_up_at optional |
string |
ISO 8601 date string of when the user signed up. Enables cohort-based retention and activation analysis. If omitted, Ripples sets it to the time of the first identify() call. |
plan optional |
string |
The user's current plan (e.g. "free", "pro"). Stored on the visitor profile and used for plan-based segmentation. |
[custom] optional |
string | number |
Any additional properties you want to attach to the user (e.g. role). To tie users to the company they work in, use ripples.group() instead of a trait. |
Examples
After login
// After successful authentication
async function onLoginSuccess(user) {
ripples.identify({
id: user.id,
email: user.email,
name: user.name,
avatar_url: user.profile_avatar_url,
signed_up_at: user.created_at, // ISO 8601
plan: user.plan,
})
}
React example
function useIdentify(user) {
useEffect(() => {
if (user) {
ripples.identify({
id: user.id,
email: user.email,
name: user.displayName,
avatar_url: user.avatarUrl,
signed_up_at: user.createdAt,
})
}
}, [user])
}
Alternative syntax
You can also pass the user ID as a string with properties as a second argument:
// Object style (recommended)
ripples.identify({ id: "user_123", name: "Jane" })
// Queue style
ripples("identify", { id: "user_123", name: "Jane" })
// String ID style (legacy)
ripples("identify", "user_123", { name: "Jane" })
ripples.getVisitorId()
Returns the current visitor’s unique ID. Use this to link client-side activity with your backend — for example, to send server-to-server events.
const visitorId = ripples.getVisitorId()
// "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Pass it to your backend on signup or checkout, store it with the user, and hand it to server-side signup() / identify() calls as visitor_id. That is what links a server-created user back to the browsing session that produced them and keeps the traffic source:
// Send visitor ID with your API call
await fetch('/api/signup', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: email,
plan: plan,
ripples_visitor_id: ripples.getVisitorId(),
}),
})
// Store the visitor ID alongside the user record, then pass it to
// server-side calls as 'visitor_id' (or let the PHP SDK read the cookie)
$user->ripples_visitor_id = $request->ripples_visitor_id;
$ripples->signup($user->id, ['email' => $user->email, 'visitor_id' => $user->ripples_visitor_id]);
Signups that finish in another browser lose their source without this. An ad tapped in the Facebook or Instagram in-app browser and a confirmation email opened in Safari are two different visitors. Only the visitor ID captured at the signup form can tie the account to the ad. See Preserving attribution for the full flow.
Visitor ID persistence: The visitor ID is stored in a cross-subdomain cookie (_rpl_vid) with a 2-year expiry, and also in localStorage as a fallback. This means app.yoursite.com and www.yoursite.com share the same visitor ID. Different browsers on the same phone do not share it.
ripples.reset()
Call it when the user logs out. It forgets the signed-in user and starts the browser over as a new anonymous visitor, so whoever uses it next is not linked to them.
async function logout() {
await fetch('/logout', { method: 'POST' })
ripples.reset()
}
reset() also clears the company set with ripples.group().
To stop tracking a browser altogether, or to erase a user who deleted their account, see Delete user data (ripples.optOut() and the deletion API).
How it works
- When you call
ripples.identify(), the user ID is saved tolocalStorageunder the key_rpl_uid, and the avatar URL under_rpl_uav. - An
identifyevent is sent to the collection endpoint with the user properties. - All future events (pageviews, tracks) will include this user ID automatically.
- The visitor profile in your dashboard will show the user’s name, email, and avatar instead of the anonymous identifier.
- The first
identify()call also setssigned_up_aton the profile (if not already set or if you pass an earlier date), which powers cohort and activation analytics.
Cross-device tracking: Once a user is identified on one device, their activity will be linked across all devices where they log in.