owned this note
owned this note
Published
Linked with GitHub
# Listrak Destination
Fueled by AI, machine learning, and predictive analytics, [Listrak](https://www.listrak.com/) helps unlock the power of customer data to create personalized, 1:1 interactions. Quickly and easily subscribe users to your list with a single API call and access Segment customer events from inside the Listrak Platform.
This destination is maintained by Listrak. For any issues with the destination, please contact the [Listrak Client Success Team](mailto:support@listrak.com).
_**NOTE:** The Listrak Destination is currently in beta, which means that they are still actively developing the destination. This doc was last updated on October 10, 2019. If you are interested in joining their beta program or have any feedback to help improve the Listrak Destination and its documentation, please [let their team know](mailto:support@listrak.com)!_
## Getting Started
{{>connection-modes}}
1. From your Segment UI's Destinations page click **Add Destination**.
2. Search for **Listrak** within the Destinations Catalog and confirm the Source you'd like to connect to.
3. Enter the **MerchantID** and **Shared Secret** in the Segment Settings UI. While the destination is in private beta, please contact the [Listrak Client Success Team](mailto:support@listrak.com) for these credentials.
4. Proceed to add the desired List ID, Contact Field Mappings, Event Mappings and Transactional Message Mappings in the settings. Please see the Listrak Subscription section for more information on how to populate these.
## Listrak Web Plugin
The first part of the Listrak destination is our web plugin. Listrak will listen for many calls defined in [Segment's Ecommerce V2 Spec](https://segment.com/docs/spec/ecommerce/v2/) for use in our Browse Abandonment and Shopping Cart Abandonment solutions.
### Page
Please take a moment to review the [page method](https://segment.com/docs/spec/page/). The page method captures page details such as title and URL when a user visits the page. An example call would look like:
```
analytics.page()
```
Page calls are sent to Listrak as a `pagebrowse`.
**NOTE:** Listrak only supports page calls via client-side analytics.js.
### Identify
Please take a moment to review the [identify method](https://segment.com/docs/spec/identify/). The identify method connects a user to their traits and actions. An example call from client-side analytics.js would look like:
```
analytics.identify('userId123', {
email: 'john.doe@segment.com',
firstName: "John",
lastName: "Doe",
});
```
### Track
Please take a moment to review the [track method](https://segment.com/docs/spec/track/). The track method records users' actions. If an email address is included in the track method as shown below, Listrak will start tracking that anonymous ID.
```
analytics.track('Email Captured', {
email: "emailCapture@listrak.com"
});
```
Listrak listens specifically for product browse, product added, product removed, and order completed track events on the client-side and order completed on the server-side. A product viewed example call would look like:
```
analytics.track('Product Viewed', {
product_id: '507f1f77bcf86cd799439011',
sku: 'G-32',
category: 'Games',
name: 'Monopoly: 3rd Edition',
brand: 'Hasbro',
variant: '200 pieces',
price: 18.99,
quantity: 1,
coupon: 'MAYDEALS',
currency: 'usd',
position: 3,
value: 18.99,
url: 'https://www.example.com/product/path',
image_url: 'https://www.example.com/product/path.jpg'
});
```
This call is sent to Listrak as a `ProductBrowse` event.
An example product added track call would look like:
```
analytics.track('Product Added', {
cart_id: 'skdjsidjsdkdj29j',
product_id: '507f1f77bcf86cd799439011',
sku: 'B-32',
category: 'Games',
name: 'Monopoly: 3rd Edition',
brand: 'Hasbro',
variant: '200 pieces',
price: 18.99,
quantity: 1,
coupon: 'MAYDEALS',
position: 3,
url: 'https://www.example.com/product/path',
image_url: 'https://www.example.com/product/path.jpg'
});
```
This call is sent to Listrak for tracking shopping cart abandonment.
An example product removed track call would look like:
```
analytics.track('Product Removed', {
cart_id: 'skdjsidjsdkdj29j',
product_id: '507f1f77bcf86cd799439011',
sku: 'B-32',
category: 'Games',
name: 'Monopoly: 3rd Edition',
brand: 'Hasbro',
variant: '200 pieces',
price: 18.99,
quantity: 1,
coupon: 'MAYDEALS',
position: 3,
url: 'https://www.example.com/product/path',
image_url: 'https://www.example.com/product/path.jpg'
});
```
This call is sent to Listrak for tracking shopping cart abandonment.
An example order completed track call would look like:
```
analytics.track('Order Completed', {
order_id: '50314b8e7bcf9900033433',
total: 27.50,
revenue: 25.00,
shipping: 3,
tax: 2,
discount: 2.5,
coupon: 'hasbros',
products: [
{
product_id: '507f1f77bcf86cd799439011',
sku: '45790-32',
name: 'Monopoly: 3rd Edition',
price: 19,
quantity: 1,
category: 'Games',
url: 'https://www.example.com/product/path',
image_url: 'https:///www.example.com/product/path.jpg'
},
{
product_id: '505bd76785ebb509fc183733',
sku: '46493-32',
name: 'Uno Card Game',
price: 3,
quantity: 2,
category: 'Games'
}
]
});
```
This call is sent to Listrak for tracking customer order history and shopping cart abandonment.
## Listrak Subscription
The second half of the Listrak Destination is our subscription. For ease of setup, the subscription is designed so the user only needs to define the Listrak actions in the Segment Settings page for the desired Segment event. When these events are fired, the Listrak action will automatically fire as well. List IDs, External Event IDs, Transactional Message IDs and Segmentation IDs can be found in the Listrak Platform, under [Solutions > API > API ID Information](https://intercom.help/listrak/en/articles/1523037-api-id-information).
### List ID
The first field to configure is your default List ID. This will be used whenever you do not specify an override list for individual events.
### Contact Field Mappings
When a user is identified, Listrak will update their information if they are already subscribed to the list. Contact Field Mappings allow you to map Segment traits to Listrak segmentation fields.
### Event Mappings
Event Mappings are used to subscribe or unsubscribe users, update segmentation data and trigger external events for Conductor conversations when the named track event is fired.
![Example Event Mappings](https://i.imgur.com/gH6WMMn.jpg)
The External Event ID is the ID of the event you want to fire in Listrak and is optional.
Subscription State determines if the user will be subscribed to or unsubscribed from the list. If an already-subscribed user goes through an event with a subscription state of subscribed, they will be updated.
The List ID field is optional, and only needed to use an event on a different list.
Field mappings allow you to map Segment traits to Segmentation fields in Listrak.
**NOTE:** For Field Mappings, 'properties.' must be prepended to the trait name.
Field Template Mappings are used for passing HTML data to a Listrak Contact Content Block for uses like Cart templates. This field supports Mustache templates to include traits.
### Transactional Message Mappings
When you want to send a message immediately without updating segmentation data, use Transactional Message Mappings. The segmentation fields here are only used to populate the message and are not saved in our systems.
![](https://i.imgur.com/nwLN8ot.jpg)
Transactional Message ID is the Listrak ID of the transactional message.
The List ID field is optional, but commonly Listrak users create a separate list for transactional messages since contacts are not subscribed when messages are triggered.
Field mappings allow mapping Segment traits to Segmentation fields in Listrak.
**NOTE:** For Field Mappings, 'properties.' must be prepended to the trait name.
Field Template Mappings is used for passing HTML data to a Listrak Contact Content Block for uses like Cart templates. This field supports Mustache templates to include traits.
## Using Mustache Templates
Traits can be included with Mustache by surrounding the trait name with curly brackets like `{{name}}`.
Mustache also supports arrays. In this case, you surround the area with the array variables with array tags. the opening tag has the array name lead by `#` like `{{#products}}` while the end tag has a forward slash `/` like `{{/products}}`. The variables follow the same format as before and go between these tags.
```
{{#products}}
<div>
<p>{{name}}</p>
<p>{{price}}</p>
</div>
{{/products}}
```
Mustache will automatically escape some characters. If this is an issue, you can prevent escaping by adding a `!` in front of the variable name like `{{!img_url}}`.
If a Mustache property is present in the mapping but not in the Segment event, it will be passed over as `undefined`. For properties that may not always be passed in, Mustache has some basic undefined checks. The below example will display the product's name if it is present. If it is not, it will display a blank string. This would also support mapping a different field or adding static text.
```
{{#products}}
{{#name}}
{{name}}
{{/name}}
{{^name}}
{{/name}}
{{/products}}
```