viakite
Dashboard

Guides/Events and goals/Identify users

Identify users

Tie events to your own user id

Viakite counts visitors without cookies, so by default it doesn't know who anyone is. When a person signs in to your app, identify ties their next events to your own user id, so you can see what each customer does. reset forgets them again on sign-out.

Identify a signed-in user

Call identify after sign-in, with your own user id and, if you like, some traits:

auth.ts
1import { identify } from "@viakite/sdk";
2
3identify("user_8231", { plan: "pro", company: "Acme" });
auth.js
1viakite.identify("user_8231", { plan: "pro", company: "Acme" });

identify sends one event with the user id and the traits. Every page view and event sent after it in this tab carries the user id too.

The id lives in memory only, for this tab. It is not stored in cookies or localStorage, so a reload, a new tab or a new visit starts anonymous again. Call identify whenever your app knows who is signed in: on sign-in, and on every page load of a signed-in session. In a React app, that is an effect that runs when your current user changes:

src/useIdentify.ts
1import { useEffect } from "react";
2import { identify, reset } from "@viakite/sdk";
3
4export function useIdentify(user: { id: string; plan: string } | null) {
5 useEffect(() => {
6 if (user) identify(user.id, { plan: user.plan });
7 else reset();
8 }, [user]);
9}

Forget the user on sign-out

auth.ts
1import { reset } from "@viakite/sdk";
2
3reset();

reset forgets the user id in this tab; later events are anonymous again. It sends nothing. Call it on sign-out, so the next person on a shared computer isn't counted as the last one.

Rules and limits

Rule
User idUp to 120 characters, your own id: a database id, a UUID, user_8231
Personal idsAn id that looks like an e-mail address or a phone number (7 digits or more) is dropped, by the SDK and again by the server
TraitsUp to 20, flat, with the same limits as event properties: names up to 40 characters, text up to 255

Never use an e-mail address or a phone number as the id. Use the id your database already has. Traits are for what helps you read the numbers (plan, company, role), not for personal data. See Events: limits.

Where it shows

Analytics → Users lists your identified users for the date range, with their visits, page views and events, out of all visitors. Click a person to open their profile and timeline: every page view and event, newest first. Through the API, user_id is a dimension you can break down and filter by, and traits are keyed dimensions such as traits.plan; see Queries.

What is linked, and what is not yet

Today
Events sent after identify, in the same tabLinked: they carry the user id
Events sent before identify the same day, by the same visitor (the anonymous part of the visit)Linked when you read them: the Users page, the person's timeline, users funnels, and API queries that break down or filter by user_id count them for the user. Stored events are not changed
Events of the same visitor that day from another tab that didn't call identifyLinked to the user that visitor identified as that day
The same person on another day or another deviceJoined by the user id in the person's timeline, in funnels that count users and in attribution with count_by: users (up to 30 days)
Filtering by a trait in the dashboardNot in the filter picker; possible through the API

A visitor id lasts one day, so linking works within that day: anonymous events of a day the person never signed in stay anonymous.

With count_by: users, the attribution endpoint credits a signed-in user's conversion to the visits of the 30 days before it, on any device: a user who first came from a Google search on their phone and signed up a week later on a laptop counts for both.

Next steps