traits event sets traits on a player. Traits are the data that describes a player, such as a level, a difficulty or a Discord ID. Event data stays properties. Unlike identify, a traits event does not need a user ID, so you can describe a player before sign-in.
Every SDK sends it with a traits() call: Web, Node, Godot, Unity and Unreal. Without an SDK, send the event to POST /v0/events in the shape below.
Example
A game build sends the traits of one install:Fields
See common fields for the envelope fields.
Anonymous and user traits
- Anonymous traits: a
traitsevent without auser_idsets traits on one browser or game install. The profile of an anonymous player shows them. - User traits: a
traitsevent with auser_id, anidentify, the player traits API and a dashboard edit set traits on the user.
- For an identified player, the user trait wins.
- Otherwise, the newest anonymous trait across the player’s browsers and game installs wins.
- A shared device (an anonymous ID linked to two or more users) gives its anonymous traits to none of those users.
Protected traits
A game or website cannot set the protected traitsemail, itch_user_id, stripe_customer_id and paddle_customer_id. Manalens drops them from web and app events. Send them from your server with the secret key, or with the player traits API.
How traits update
- A later event updates only the keys that it sends.
- A
nullvalue clears a key.