# New Relic Destination

## Destination Info

* Accepts [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **New Relic** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)

### Components

* Server

## Connection Modes

[Learn more about connection modes.](/docs/segment/connections/destinations/#connection-modes)

### Device-Mode

* web: no
* mobile: no
* server: no

### Cloud-Mode

* web: yes
* mobile: yes
* server: yes

[New Relic](https://newrelic.com/) enables you to better understand, using their real-time analytics, the end-to-end business impact of your software performance.

## Getting Started

1. From the Segment web app, click **Catalog**.
2. Search for "New Relic" in the Catalog, select it, and choose which of your sources to connect the destination to.
3. In the destination settings, enter your Insights [Account ID](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/account-id) and your [Insert Key](https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/insert-custom-events-insights-api#register).
4. Once destination enabled we'll start forwarding your calls to New Relic.

## Track

If you're not familiar with the Segment Specs, take a look to understand what the [Track method](/docs/segment/connections/spec/track/) does. An example call would look like:

```text
analytics.track('Article Completed', {
  title: 'How to Create a Tracking Plan',
  course: 'Intro to Analytics',
});
```

We forward `track` calls to New Relic in order to [insert custom events using their Insights API](https://docs.newrelic.com/docs/insights/new-relic-insights/adding-querying-data/inserting-custom-events).

Your event `properties` will be included with the event, conforming to the following rules:

* booleans are transformed to strings
* reserved nrql words are wrapped with backticks
* reserved words are removed
* dates are converted to ISO strings
* arrays and objects are removed

By default the events are given an `eventType` of 'Segment'. This can be changed using the optional 'Custom Default Event Type' setting in the Segment UI.

If you pass a revenue property, we'll pass that through as the value of the conversion.

## Engage

You can send computed traits and audiences generated using [Engage](/docs/segment/engage) to this destination as a **user property**. To learn more about Engage, schedule a [demo](https://segment.com/contact/demo).

For user-property destinations, an [identify](/docs/segment/connections/spec/identify/) call is sent to the destination for each user being added and removed. The property name is the snake\_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property `order_completed_last_30days: true`. When the user no longer satisfies this condition (for example, it's been more than 30 days since their last order), Engage sets that value to `false`.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

> \[!NOTE]
>
> Real-time audience syncs to New Relic  may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.

## Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

| Field                             | Description                                                                                                                                                                                            | Required | Type     |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | -------- |
| Account ID                        | Your New Relic Insights account ID                                                                                                                                                                     | Yes      | string   |
| Custom Default Event Type         | By default the eventType for any unmapped track events will be sent as 'Segment'. You can define another custom eventType name to be used instead of that here.                                        | No       | string   |
| Map Track Events to Custom Tables | Enter your Segment \`.track()\` event names on the left and their respective eventType (table name) in New Relic.                                                                                      | No       | text-map |
| Insert Key                        | Put your New Relic Insert Key                                                                                                                                                                          | No       | string   |
| Endpoint Region                   | The destination will send your data to an endpoint in this region.                                                                                                                                     | Yes      | select   |
| Send Device Context               | If you enable this setting, we will flatten all your \`context\` fields delimited by a period and send it to New Relic. This is recommended as getting rich device context is useful inside New Relic. | No       | boolean  |
| Send UserId and AnonymousId       | If you want to send your Segment \`userId\` and \`anonymousId\`, enabling this option will do so.                                                                                                      | No       | boolean  |
