# track

Learn how to track an event in the user session.

This method tracks an event for \[analytics(/reference/analytics) and personalization purposes.

## Signature

This method has the following signature:

```ts
tracker.track(event: string, payload: EventPayload): Promise<Event>
```

The return is a `Promise` that resolves to the tracked event after successful transmission.

## Example

Here is a basic example of how to use this method:

```ts
import croct from '@croct/plug';

croct.tracker.track('goalCompleted', {goalId: 'newsletter-sign-up'});
```

## Parameters

The following list describes the supported parameters:

- `event`: `string`

  The name of the event to track.

  For a list of supported events, see the [Event reference](/reference/event/overview#event-types).

- `payload`: `object`

  The payload of the event for the specified event type.

  For more information about the payload structure, see the [Event reference](/reference/event/overview#event-types).
