# AdRoll Destination

## Destination Info

* Accepts [Page](/docs/segment/connections/spec/page), [Identify](/docs/segment/connections/spec/identify), [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **AdRoll** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)

### Components

* [Browser](https://github.com/segment-integrations/analytics.js-integration-adroll)

## Connection Modes

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

### Device-Mode

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

### Cloud-Mode

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

[AdRoll](https://adroll.com/) is a retargeting network that allows you to show ads to visitors who've landed on your site while browsing the web. The AdRoll Destination is open-source. You can browse the code on [GitHub](https://github.com/segment-integrations/analytics.js-integration-adroll).

## Getting Started

1. From the Segment web app, click **Catalog**.
2. Search for "Adroll" in the Catalog, select it, and choose which of your sources to connect the destination to.
3. Locate both your AdRoll Advertiser ID and Pixel ID in AdRoll's "Audience" tab, "AdRoll Pixel" section. Click on "View Pixel". Your Advertiser ID will be listed beside `adroll_adv_id` and your AdRoll Pixel will be listed beside `adroll_pix_id`.

   ![AdRoll Audience page showing site audience metrics and active pixel status.](https://docs-resources.prod.twilio.com/8805dd57010c0e30082ea3d743cbc98dc1cb9e01dbb18ba9a6e8ad16c2c25d94.png)
4. Add both your Advertiser ID and Pixel ID to your Segment Destination Settings.

## Page

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

```javascript
analytics.page()
```

***NOTE:** The `page` call **must** be made on a page for any `identify` or `track` events to be sent to AdRoll. Our Analytics.js snippet includes a `page` call by default so you should be fine, unless you've manually removed the page call from your Analytics.js snippet.*

## Identify

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

```javascript
analytics.identify('123', {
  email: 'testing@segment.com'
});
```

Set a `userId` using the `identify` call which will then be passed it to AdRoll each time a [`track`](/docs/segment/connections/destinations/catalog/adroll/#track) call is made. If you pass an `email` trait, we'll send that to AdRoll by setting `window.adroll_email` to that value.

## 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:

```javascript
analytics.track('Sign-up Form Completed');
```

In order to send your `track` calls to AdRoll for segmenting your users, get started by creating a new "segment" in their interface, copying the "Segment ID", and pasting that following a `+` into the URL rule field.

![Animation showing user creating a new Segment user in Adroll with conversion metrics and date selection.](https://docs-resources.prod.twilio.com/2c416b8bbfcabe0ba84a7f7a968ee8d6ee338c4f02609df6dbe7398acc08b49d.gif)

Map your client-side Analytics.js event names to the corresponding AdRoll "Segment ID" in the Segment Settings UI.

![AdRoll event settings with Sign-up Form Completed and Button Clicked mapped to Segment IDs.](https://docs-resources.prod.twilio.com/79078bf233badc69bed727fa7e57f2777ab141df0453b51577ddfbee401e5ffb.png)

We'll fire the correct pixel accordingly to put the user into that "segment" whenever they trigger the event you've chosen. Note that you will still need to map semantic events like `Viewed Product`, `Added Product`, and `Order Completed`.

Then, inside AdRoll you can create a "segment" of all users doing any of those events by adding a `+` to the segment name and adding it in the URL field, like this:

![A screenshot of the New User Segment page in Adroll, with a specified name, url pattern, and duration.](https://docs-resources.prod.twilio.com/e008f381abc4a6ba0f7b5840b51ce603adedd0289f1659912378543691bd95e4.png)

### Conversion Value

When you include an event property labeled `price` it will be tracked to AdRoll as `adroll_conversion_value`.

### Currency

When you send `Order Completed` event with `properties.currency`, we will send that as `adroll_currency`. AdRoll supports [these currency codes](https://help.adroll.com/hc/en-us/articles/213429827-Currency-Codes).

### Order ID

If you send an `Order Completed` event with `properties.orderId`, we will send that as `order_id`.

```javascript
analytics.track('Order Completed', {
  revenue: 100,
  currency: 'USD',
  orderId: 'abc12345'
});
```

### Product ID

If you send a `Viewed Product` or `Added Product` with `properties.id` we will map it as `product_id`.

```javascript
analytics.track('Vewed Product', {
  id: 'abc98765'
});
```

### **Legacy:** Named Segments

Prior to rolling out Segment ID's, AdRoll allowed "named segments". If your account was created prior to 2015, then the track events you send from the browser using our [`analytics.track`](/docs/segment/connections/destinations/catalog/adroll/#track) method will be passed on to AdRoll as `adroll_segments` with the segment being the snake-cased event name.

## Troubleshooting

### Script unverified or undetected by third-party tool

Many times this is a limitation on the tool's detection process, where the detector is looking for a specific HTML element on your page. Our client side analytics.js library asynchronously loads the tool's library or pixel onto the page. As such, the detection fails.

In order to confirm that the tool's library or pixel is actually loaded onto the page, you can open up the [JavaScript console](/docs/segment/connections/sources/catalog/libraries/website/javascript#how-do-i-open-the-javascript-console-in-your-debugger) and go to the network tab when the page is loading.

![Checking network tab to see if script loads.](https://docs-resources.prod.twilio.com/8a2cd023e90dc07c18494061e6013d19469548d2b7a40f6f4dba91417b7d6b39.gif)

If the script isn't loading, check that any form of ad blocker is disabled.

## Settings

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

| Field         | Description                                                                                                                                                                                                                                                                                                              | Required | Type     |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | -------- |
| \_version     |                                                                                                                                                                                                                                                                                                                          | No       | number   |
| Advertiser ID | You can find your Advertiser ID in your AdRoll dashboard by clicking the \*\*green or red dot\*\* in the lower-left corner. In the Javascript snippet, the Advertiser ID appears as \`adroll\_avd\_id = 'XXXXXXX'\` on line 2. It should be 22 characters long and look something like this: \`WYJD6WNIAJC2XG6PT7UK4B\`. | Yes      | string   |
| Events        | AdRoll allows you to create a Segment Name and ID for conversions events. Use this mapping to trigger the \*AdRoll Segment ID\* (on the right) when the Event Name (on the left) is passed in a Track method.                                                                                                            | No       | text-map |
| Pixel ID      | You can find your Pixel ID in your AdRoll dashboard by clicking the \*\*green or red dot\*\* in the lower-left corner. In the Javascript snippet, the Pixel ID appears as \`adroll\_pix\_id = 'XXXXXXX'\` on line 3. It should be 22 characters long, and look something like this: \`6UUA5LKILFESVE44XH6SVX\`.          | Yes      | string   |
