# Heap Integration

Intelligems can send a custom event to Heap for each experiment impression, with the user's test group ID. The event is sent on each page view, with information about each experiment that's live.

The custom event is called `Intelligems Impression` and has two properties for each experiment:

* `Exp <experiment name>` with value `<test group name>`
* `Var <test group name>` with value `true`

To enable the Heap integration, simple click "Enable" on the integrations page.

### Additional settings

By default, Intelligems will send an event to Heap on every page view for every live experience. You can change this by choosing a `trackMode` in a `window.igSettings` object. For example:

```html
<script>
window.igSettings = {
    integrations: {
        heap: {
            trackMode: "impression" // default, track on every page view
        }
    }
}
</script>
```

Track mode options are:

* `impression` (default, send event on every page view for each experiment)
* `assignment` (send event only once per visitor per experiment, on assignment)
* `timed` (send event once per visitor per experiment, re-sending after a specified amount of time has passed)
  * `timeSinceAssignment` additional setting, in seconds, that controls the time threshold, defaults to 1800 (30 minutes)

For example, to send the event once per visitor per experiment, and re-send it after at least 60 minutes has passed:

```html
<script>
window.igSettings = {
    integrations: {
        heap: {
            trackMode: "timed",
            timeSinceAssignment: 3600 // re-send after an hour has passed
        }
    }
}
</script>
```


---

# 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://docs.intelligems.io/integrations/heap-integration.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.
