# Event tracking

Track what your users do in your product, with properties, so you can trigger surveys and messages on their actions.

Track the actions your users perform: a plan upgrade, a product added to the cart, an export. In Screeb, you then target surveys and messages on these events, for example on how many times a user did it or when they last did it. What events are on the Screeb side is explained in [Understanding user events](https://help.screeb.app/user-data/user-events/).

## Track an event

```ts
import * as Screeb from "@screeb/sdk-browser";

Screeb.eventTrack("plan_upgraded");
```

Event names are less than 128 characters. They contain letters, digits, spaces and the characters `-`, `_`, `.`, `/` and `:`. Keep each name stable: a renamed event is a new event for Screeb.

## Add properties to an event

Properties give the context of the event. You can use them in targeting rules and as hidden fields in your surveys.

```ts
Screeb.eventTrack("Product added to cart", {
  product_name: "Red bike 2021",
  category: "sport",
  price: 299,
  count: 1,
  user_logged: false,
  added_at: new Date(),
});
```

An event has at most 1000 properties. Property names are 128 characters at most. Values are strings, numbers, booleans or dates.

> [!NOTE]
> Screeb ignores events while [consent exemption](https://developers.screeb.app/sdk-browser/consent-exemption) is on for the workspace.

## Next steps

- [Track screens](https://developers.screeb.app/sdk-browser/screen-tracking) to target surveys on the pages or screens your users visit.
- [Assign users to groups](https://developers.screeb.app/sdk-browser/group-assignation) to target a company, a team or a plan.
