Identify players who sign in
Without sign-in, every device is its own player: one person on a phone
and two browsers counts three times, and the website visits before they
signed in count as a fourth. If your game has its own sign-in, call
identify with a random id for the account after a player signs in and
resetIdentity when they sign out. Ravensight then links the
device to the account, including what it played before signing in.
The calls
Call them any time after init, even before the first session opens. Each SDK has them from the version in the table. Where it says not released yet, that SDK's current version cannot identify a player, so a game built on it counts each install as a player.
| SDK | After sign-in | On sign-out | From version |
|---|---|---|---|
| JavaScript | rs.identify(accountId) | rs.resetIdentity() | 0.12.0 |
| Godot | Ravensight.identify(account_id) | Ravensight.reset_identity() | 0.7.0 |
| Unity | Ravensight.Identify(accountId) | Ravensight.ResetIdentity() | 0.6.0 |
| Unreal | Identify(AccountId) on the Ravensight subsystem | ResetIdentity() | 0.6.0 |
| LÖVE | ravensight.identify(accountId) | ravensight.resetIdentity() | 0.8.0 |
| iOS | Ravensight.identify(accountId) | Ravensight.resetIdentity() | 0.7.0 |
| Android | Ravensight.identify(accountId) | Ravensight.resetIdentity() | 0.6.0 |
| C++ | client.identify(account_id) | client.reset_identity() | 0.6.0 |
| Odin | identify(client, account_id) | reset_identity(client) | 0.7.0 |
| GameMaker (preview) | ravensight_identify(account_id) | ravensight_reset_identity() | 0.2.0 |
| Defold (preview) | ravensight.identify(accountId) | ravensight.resetIdentity() | 0.2.0 |
| Flutter (preview) | Ravensight.identify(accountId) | Ravensight.resetIdentity() | 0.2.0 |
| Cocos Creator (preview) | client.identify(accountId) | client.resetIdentity() | 0.2.0, with the JavaScript SDK 0.12.0 or later installed |
| Construct 3 (preview) | The Identify player action | The Reset identity action | 0.2.0, built with the JavaScript SDK 0.12.0 or later |
| Roblox (preview) | Ravensight.identify(player, accountId) | Ravensight.resetIdentity(player) | 0.2.0 |
In a LÖVE web build the page's JavaScript SDK sends the identity: call
rs.identify and rs.resetIdentity on the page,
with the JavaScript SDK 0.12.0 or later. The LÖVE calls are for desktop
builds.
Pass a random, high-entropy id, such as a random UUID or a random
analytics id you make once for each account and store with it. Never
pass a sequential database key, an email address, a name or a platform
handle: your game's salt reaches every copy of the game, so anyone could
hash 1, 2, 3 and onward and match a guessable id, while a random one
cannot be guessed. The SDK refuses any value that contains
@, an empty value, and anything longer than 256 bytes, and
sends nothing for it.
The identity is kept across launches. Signing in as a different account
on the same device starts a fresh device id first, and so does
resetIdentity, so the next person's play is not credited to
the last account.
What is sent
The id you pass never leaves the device. Each game has its own random
salt, which the SDK receives when a session opens; the SDK sends an
HMAC-SHA256 of that id keyed by that salt, once per session,
with the session it belongs to. Ravensight stores a player id made from
that hash (px_ and 32 hex characters).
This is a pseudonym, not anonymisation: anyone who has your game's salt and can guess an id can work out its hash. That is why the id must be random. The hash still identifies one player across sessions, so it is a pseudonymous identifier: declare it in your game's privacy notice. The same account in two of your games gets two unrelated ids.
To find a player's id yourself, take the salt from
GET /api/v1/identify/config with your game's key, compute
the lowercase hex HMAC-SHA256 of the id you passed to
identify with the salt's 64
characters as the key (as text, not decoded), and keep
px_ plus its first 32 characters.
Verified links
Any copy of your game can claim any account, so claims are bounded: one
device can claim at most three different accounts a day, and further
claims that day are refused free of charge. If your game has a backend
that checks sign-ins, it can vouch for one instead: post
{ "accountHash", "sessionToken" } to
/api/v1/identify/verified with the game's live key, using
the session token the game passes it. A verified link is outside the
daily limit, and a later claim never moves it to another account.
Counting players
In Settings, open the environment and choose who counts as a player under Count players by:
- Automatic, the default: one person across devices, with what a device played before signing in, once your game has identified a player; each install until then.
- Device: each install is a player, always.
Every game starts on Automatic, so a game that never identifies anyone keeps counting installs. If your studio chose Device before, that choice stays.
Player counts, retention, returning players and the Overview all follow the choice. Experiments stay assigned by device. Daily totals already stored keep the count they were made with.
Price and limits
Each accepted identify is one event on your usage, drawn from the
included monthly events first and then your prepaid balance. That is
one event for each session of a player who is signed in. Repeating an
identify in the same session, and every refused call, is free. With an
empty balance the call is refused with needs_funds; the
game keeps playing and the SDK tries again at the next session.
Deleting a player
An owner or admin can delete an identified player with
DELETE /api/v1/games/<gameId>/identified-players/<playerId>.
Its links go at once, and its events are erased in the background:
everything sent after it was identified, plus the earlier history of
any device your backend verified for it. The earlier history of a device
that only the game claimed stays, unlinked, because any copy of a game
can claim any device. For questions, write to
support@realityse.com.