Users, sessions and installs
The three ids that tie events to a person, a visit and a device.
| Id | Who sets it | What it means |
|---|---|---|
user_id | Your app (setUser) | Your own id for the person: an account id, a player id. Up to 128 bytes. |
session_id | The SDK | One visit. On a device, a new session starts after 30 minutes without any event; on a server, see below. |
install_id | The SDK | One installation of the app: a random UUID kept on the device. |
Users
Call setUser once you know who the person is, and every following event carries that id. Pass
nil / null / None / "" to clear it (on sign-out). Lyrelog never makes up a user id: events
logged before setUser have none.
Each project picks the word it uses for its people (users, players, customers...) in Settings. The dashboard uses it everywhere: the Players page of a game is the Customers page of a shop.
Sessions
How each SDK makes sessions:
| SDK | Session |
|---|---|
| Swift | A new one after 30 minutes without an event (sessionTimeout) |
| Android | A new one after 30 minutes without an event (sessionTimeoutMillis) |
| React Native, Flutter | The native SDK's: a new one after 30 minutes without an event (sessionTimeoutMs, sessionTimeout) |
| JavaScript, browser | One per tab, kept in sessionStorage with the time of the last activity, so a reload continues it; a new one after 30 minutes idle |
| JavaScript, Node | One per process, for as long as it runs |
| Python | One per process, and a new one after 30 minutes without an event (session_timeout) |
| Go | One per process, for as long as it runs |
| JVM | One per process, for as long as it runs |
On a server a session says little about a person: group by user_id instead.
Reports that arrive later, like a crash reported on the next launch, keep the time they happened. Swift's have no session; an Android crash keeps the session it ended.
Installs
The install id survives launches and updates but not a reinstall. It is not an advertising
identifier and isn't linked to anything else on the device. On Android it lives in
noBackupFilesDir, so it's never in a backup restored on another device. On the web it lives in
localStorage. On servers (Node, Python, Go, the JVM) it is a new id for each process. React Native and
Flutter apps keep the native SDK's.
The user id isn't kept: call setUser again on each launch once you know who the person is.