# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://headless.intelligems.io/version-1.2.16/examples/custom-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
