# Custom Events

## **General Information**

{% embed url="<https://docs.intelligems.io/developer-resources/custom-events-tracking#intelligems-context>" %}

## **API**

Custom events are available after you call `useIgTrack()` (or `useIgCustomEvents()` directly). Track an event by calling `igEvents.push()`. The object passed into `push` accepts two parameters:

```html
window.igEvents.push({"event": "myCustomEventName"});
```

`event`: the name of your event, meant to uniquely identify the action you're tracking. This will be used to categorize events when viewing analytics in our dashboard.

{% hint style="info" %}
Commas, single quotes, and trailing spaces will be stripped from event names
{% endhint %}

`properties`: arbitrary key value pairs, anything goes as long as it's valid JSON. Use this to add context relevant to the `event`. It'll help you create more fine-grained queries among a single `event` when digging into your analytics.

{% hint style="danger" %}
Properties will be saved for future use, but are not currently available for analysis in Intelligems analytics.
{% endhint %}

## **Intelligems Context**

Intelligems appends other meaningful metadata to your events. This lets you associate custom event flows with actionable outcomes that Intelligems tracks by default. Includes but not limited to:

* Intelligems assigned unique user identifier, set in local storage so it persists across sessions
* Test groups the user is assigned to for any active experience
* Campaigns the user is included in
