# TrackJS

## Integration Steps:

### Step 1: Install TrackJS&#x20;

Ensure that TrackJS is properly installed and initialized within your application. This typically involves adding the TrackJS JavaScript snippet to your project's HTML file(s). Make sure to replace `<YOUR_TRACKJS_TOKEN>` with your actual TrackJS token.

```javascript
window.TrackJS && TrackJS.install({ 
    token: "<YOUR_TRACKJS_TOKEN>"
});
```

### Step 2: Retrieve the Zipy Session URL&#x20;

To include the Zipy session URL in TrackJS exception reports, you need to fetch the current Zipy session URL using the `getCurrentSessionURL()` function provided by the Zipy SDK. Assign the retrieved URL to the `zipySessionUrl` variable.

```javascript
const zipySessionUrl = window.zipy.getCurrentSessionURL();
```

### Step 3: Add Zipy Session URL as TrackJS Metadata&#x20;

In order to include the Zipy session URL in the TrackJS exception reports, you can leverage TrackJS's metadata feature. Use the `addMetadata()` function provided by TrackJS to associate the Zipy session URL with the `"zipy_session_url"` key.

```javascript
TrackJS.addMetadata("zipy_session_url", zipySessionUrl);
```

### Step 4: Verify Zipy Session URL in TrackJS Metadata&#x20;

When viewing a specific exception report in TrackJS, navigate to the "Metadata" section. Here, you should find the `"zipy_session_url"` key along with its corresponding value, which represents the Zipy session URL.

<figure><img src="/files/D34waWRptYst91B8C61t" alt=""><figcaption></figcaption></figure>


---

# 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.zipy.ai/integration/trackjs.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.
