> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manalens.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Traits

> Reference for the traits event: set traits on a player, with or without a user ID, from your website, your game or your backend.

A `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`](https://docs.manalens.dev/data/events/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](https://docs.manalens.dev/sdks/web.md#traits), [Node](https://docs.manalens.dev/sdks/node.md#traits), [Godot](https://docs.manalens.dev/sdks/godot.md#traits), [Unity](https://docs.manalens.dev/sdks/unity.md#traits) and [Unreal](https://docs.manalens.dev/sdks/unreal.md#traits). Without an SDK, send the event to `POST /v0/events` in the shape below.

## Example

A game build sends the traits of one install:

```json theme={null}
{
  "type": "traits",
  "channel": "app",
  "anonymous_id": "3f0c5c1e-8a8e-4c1b-9d7e-2b1f4e6a9c10",
  "session_id": "1762682400000",
  "message_id": "0f4b0c39-4a77-4f3c-a5e2-6f5c1f2b7d10",
  "version": "1",
  "original_timestamp": "2026-11-26T10:00:00.000Z",
  "context": { "app": { "platform": "windows" } },
  "traits": { "level": 3, "difficulty": "hard" }
}
```

## Fields

| Field | Required | Description |
| - | - | - |
| `type` | Yes | `traits` |
| `channel` | Yes | `web`, `app` or `server` |
| `traits` | Yes | A flat object with 1 to 50 keys of 1 to 100 characters, and at most 8 KB as JSON. Values are strings (at most 1024 characters), numbers, booleans or `null`. |
| `anonymous_id` or `user_id` | Yes, one of them | Without a `user_id`, the traits belong to that browser or game install. With a `user_id`, they are user traits, like `identify`. |
| `event` | No | Not allowed on `traits` |

See [common fields](https://docs.manalens.dev/data/events/common.md) for the envelope fields.

## Anonymous and user traits

* **Anonymous traits:** a `traits` event without a `user_id` sets traits on one browser or game install. The profile of an anonymous player shows them.
* **User traits:** a `traits` event with a `user_id`, an `identify`, the [player traits API](https://docs.manalens.dev/api/players/update-traits.md) and a dashboard edit set traits on the user.

The profile shows one value per trait:

* 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 traits](https://docs.manalens.dev/data/known-traits.md#protected-traits) `email`, `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](https://docs.manalens.dev/api/players/update-traits.md).

## How traits update

* A later event updates only the keys that it sends.
* A `null` value clears a key.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.