How do traits work in Manalens?

Traits are allowed only on identify events. Keys have at most 100 characters. Values are strings of at most 1024 characters, numbers, booleans or null. A later identify updates only the keys that it sends, and a null value clears a key.

You can also edit traits on the player's profile page. The change is saved as a new identify event with the channel dashboard. A backend can set traits with the secret key, and an API key with the profiles:write scope can set them through the REST API.

Sources: Manalens identify event, MCP and server events documentation.

What does an example look like?

Example: your game calls identify("player_42", {"plan": "supporter"}) when a player buys the supporter pack. Later it calls identify("player_42", {"discord_role": "tester"}). The profile now has both traits, because the second call changed only discord_role. A call with {"plan": null} would clear the plan.

Sources: worked example; Manalens identify event documentation.

Why do user properties matter for indie PC and web games?

They let you compare groups of players, such as supporters and other players, or testers and buyers. Mixpanel describes profile properties the same way: they describe who the user is and show the latest known state, while event properties describe one event.

Use a stable ID from your own game or backend as the user ID. Email is an optional trait, not the identity key.

Sources: Mixpanel documentation: User profiles; Manalens core concepts documentation.

Frequently asked questions

How do I remove a user property?

Send identify with the key set to null. A null value clears that key. Other traits stay as they are, because a later identify updates only the keys that it sends. You can also edit traits on the player's profile page.

Should I use an email as the user ID?

No. Use a stable ID from your own game or backend as the user ID. In Manalens, email is an optional trait, not the identity key, and the user ID has 1 to 255 characters. A stable ID keeps the same player history when the player changes the email address on their account.

Who can set traits?

Your game sets traits with an identify call. A backend can set them with the secret key, and an API key with the profiles:write scope can set them through the REST API. You can also edit traits on the player's profile page, and the change is saved as a new identify event with the channel dashboard.

Sources and implementation