# 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 %}
