# 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

```dart
import 'package:plugin_screeb/plugin_screeb.dart';

await PluginScreeb.trackEvent("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.

```dart
await PluginScreeb.trackEvent("Product added to cart", properties: <String, dynamic>{
  'product_name': 'Red bike 2021',
  'category': 'sport',
  'price': 299,
  'count': 1,
  'user_logged': false,
  'added_at': DateTime.now(),
});
```

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-flutter/consent-exemption) is on for the workspace.

## Next steps

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