# Application events

Send your own product events into Foldspace analytics with foldspace.track() to power audiences, segments, and reports.

Track application events from your product with `foldspace.track()`. Each event is attributed automatically to the identified user, so the call takes no user argument. Events flow into Foldspace analytics: every event shows up in the [Event Explorer](/user-guides/analytics/events-metrics/), and the things people do in your app (not just their agent conversations) become available across the [Audience](/user-guides/analytics/audiences/), [Segments](/user-guides/analytics/segments/), and [Reports](/user-guides/analytics/reports/).

This is the inbound counterpart to analytics forwarding: forwarding pushes agent events *out* to [Mixpanel](/reference/mixpanel/) or [Amplitude](/reference/amplitude/), while `track()` brings your product events *in* to Foldspace.

:::note[Prerequisites]
The [SDK is installed](/start/install/) and you've [identified the user](/start/user-context/) — each event is attributed to the identified user.
:::

## `track(eventName, properties?)`

```javascript
foldspace.track("Report_Exported", {
  report_type: "quarterly_summary",
  format: "pdf",
  page_count: 12,
  workspace: "acme-inc",
});
```

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `eventName` | string | Yes | The name of the event, e.g. `Report_Exported`. Use a consistent, stable name so events group correctly in analytics. |
| `properties` | object | No | A flat map of custom attributes describing the event. Values should be strings, numbers, or booleans. |

## Naming events and properties

- Keep event names **stable and human-readable** — `Report_Exported`, `Checkout_Completed`, `Plan_Upgraded`. The same name should always represent the same action.
- Use `snake_case` keys for properties and keep them **flat** (no nested objects or arrays). Flat string/number/boolean values are what segments and report filters can group and filter on.
- Send the same property keys every time you fire a given event, so values line up across users.

## Examples

Track a simple event with no properties:

```javascript
foldspace.track("Pricing_Page_Viewed");
```

Track a conversion with structured attributes:

```javascript
foldspace.track("Checkout_Completed", {
  order_id: "ord_8821",
  currency: "USD",
  amount: 129.0,
  items: 3,
  coupon_applied: true,
});
```

## Notes

- Call `track()` any time after the embed snippet has loaded on the page.
- If no user has been identified yet, the event is still recorded against the current anonymous visitor.
- Only the properties you pass are sent — Foldspace does not collect additional page data with the event.
- Application events appear in the [Event Explorer](/user-guides/analytics/events-metrics/) and alongside agent activity in a user's [profile](/user-guides/analytics/user-profiles/), and can be used to build [segments](/user-guides/analytics/segments/) and [reports](/user-guides/analytics/reports/).

## Related

- [Event Explorer](/user-guides/analytics/events-metrics/): browse and verify the events you send.
- [User context](/start/user-context/): identify users so events attribute correctly.
- [Mixpanel](/reference/mixpanel/) and [Amplitude](/reference/amplitude/): forward agent events out to your analytics stack.
- [Audience](/user-guides/analytics/audiences/): see every identified and tracked user.
