# Raygun

Add a Zipy session URL to every Raygun exception report.

The `rg4js('withCustomData', {})` function in Raygun allows you to attach custom data to an error or performance report before it is sent to the Raygun service. The `withCustomData` function is one of several functions available in the Raygun JavaScript library that can be used to customize and control the data that is reported to the Raygun service.

The `withCustomData` function takes a single argument, which should be an object containing the custom data that you want to attach to the error or performance report. This data can be any valid JavaScript object or primitive, such as a string, number, or array.

{% tabs %}
{% tab title="V2 of raygun library" %}

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

try {
    throw new Error("Error Created for Raygun V2");
} catch (error) {
    rg4js('withCustomData', { zipy : zipySessionUrl });
    rg4js('send', error);
}
```

{% endtab %}

{% tab title="V1 of raygun library" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>// V1 of raygun library
</strong>const zipySessionUrl = window.zipy.getCurrentSessionURL();

try {
  throw new Error("Error Created for Raygun V1");
} catch (error) {
  Raygun.withCustomData({ zipy : zipySessionUrl });
  Raygun.send(error);
}
</code></pre>

{% endtab %}
{% endtabs %}


---

# 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/raygun.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.
