---
title: Add custom attributes to synthetic monitoring data
source: https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/add-custom-attributes-synthetic-monitoring-data
---

New Relic's `$util.insights` is a set of tools to set and manipulate [events](https://docs.newrelic.com/docs/using-new-relic/data/understand-data/new-relic-data-types#event-data) reported from synthetic monitoring.

You can add custom data as custom attributes, with the prefix `custom`, to the `SyntheticCheck` [event](https://docs.newrelic.com/docs/data-apis/understand-data/new-relic-data-types/#event-data). These attributes are in addition to the event's [default attributes](https://docs.newrelic.com/docs/insights/new-relic-insights/decorating-events/synthetics-default-attributes-insights#syntheticcheck-table).

## Compatibility [#h2-compatibility]

This functionality is available for [monitor versions 0.2.0 or later](https://docs.newrelic.com/docs/synthetics/new-relic-synthetics/scripting-monitors/scripted-monitor-runtime-environment).

## Functions [#h2-functions]

| Function                                                                        | Return value |
| ------------------------------------------------------------------------------- | ------------ |
| `$util.insights.set(key: string, value: ?)` Sets a key/value pair.              | void         |
| `$util.insights.get(key: string)` Returns the value for the provided key.       | object       |
| `$util.insights.getKeys()` Returns an array of keys currently set.              | object       |
| `$util.insights.has(key: string)` Returns `true` if the key exists in the data. | boolean      |
| `$util.insights.unset(key: string)` Removes the key/value pair.                 | void         |
| `$util.insights.unsetAll()` Removes all custom data.                            | void         |

## Example

The example obtains the latest alert event from New Relic's RSS status feed and saves the details for this event.

```javascript
var parseString = require("xml2js").parseString;

// Get the New Relic status RSS feed
$http.get("https://status.newrelic.com/history.rss", function (err, response, body) {
  parseString(body, function (err, result) {
    // Parse the RSS, and get the latest incident
    var latestIncident = result.rss.channel[0].item[0];

    // Push the incident details to New Relic
    $util.insights.set("Incident", latestIncident.title[0]);
    $util.insights.set("Description", latestIncident.description[0]);
    $util.insights.set("Date", latestIncident.pubDate[0]);
  });
});
```

To view the alert event data sent to New Relic in this example, use this query:

```sql
FROM SyntheticCheck SELECT latest(custom.Date), latest(custom.Incident), latest(custom.Description)
WHERE monitorName = 'Monitor Name Here'
```
