Segment Destination

Segment is a customer data platform (CDP) that enables you to collect, transform, send, and archive your first-party customer data. Segment simplifies the process of collecting data and hooking up new tools, allowing you to spend more time using your data, and less time trying to collect it.

The Sailthru Segment Destination allows organizations using Segment to easily pass crucial marketing data points from your Segment account into Marigold Engage by Sailthru user profiles with just a few clicks. Out-of-the-box features include:
  • 1:1 profiles for identified Segment users
  • Pageviews, Sessions, and Interest Gathering
  • Automation entry points from any Segment event
  • Specialty automation triggers for Abandoned Cart & Abandoned Browse
  • Purchase-driven automation, segmentation, and personalization

Installation

Best Practice: Connecting your account with a third party vendor requires a 3rd party API Key and Secret. For your account security, you should use a different Key and Secret for each integration. Contact support to request an integration-specific Key and Secret.

To install the Segment destination, visit this link which will take you to the integration's listing in the Segment marketplace. Once installed, you can set up your API Key, Secret, and whether you'd like to track pageviews automatically to Sailthru from Segment. 

Note: Ask support to enable your account for EXTID support. This will be used to store Segment userId values on profiles.

User Profiles

When you call Segment's identify() function, the system will automatically create or update a profile for any user with a valid user ID.
analytics.identify("assigned-userId", {
 "name": "Stephen Noel",
 "email": "snoel@sailthru.com",
 "plan": "premium",
 "logins": 5
});
Email and User ID will be automatically mapped to profile keys, with all other identify properties appearing in user profile custom fields.

Note: Sailthru will also search for the email address in the identify call() under context.traits if not provided at the top-level.

Deleting User Profiles

To delete a user profile, you can create a User Deleted event in Segment's track() API.  This will delete the user's profile.

analytics.track("User Deleted", {userId:" " });

Note: Segment's track() will need either a userID at the top level or an email address in the track() call under context.traits.

Adding to Lists

To add users to lists, you can create a Subscribed Segment event with a list property. This will add the user to the natural list and mark the user as opted in

analytics.track("Subscribed", {
 "list": "Master List"
});

Alternatively, use Lifecycle Optimizer to create your own signup flow from any Segment event.

Purchases & Carts

Marigold Engage by Sailthru will automatically process Segment Order Completed, Product Added, and Product Removed events as purchases and abandoned cart updates. This will allow you to use Lifecycle Optimizer's Purchase Made and Cart Abandonment entries automatically (note: Cart Abandonment does require pageview data to be enabled in Segment destination settings or Onsite javascript).

Required Fields

  • For eCommerce data, a url property is required for each line item.
  • cart_id and email are required for Product Added and Product Removed events.

If email is not supplied in your Segment Order Completed event, we will make our best effort to correlate preexisting profile data. In the unlikely event no email can be found after multiple correlation attempts, the purchase event will be marked with an error in Segment. This will allow you to replay the event once the user's email has been established.

Optional Fields

  • clearIncompleteCartAfterNHours can be used on Product Added and Product Removed events to remove stale items from a shopping cart.
If email is not supplied in your Segment Order Completed event, we will make our best effort to correlate preexisting profile data. In the unlikely event no email can be found after multiple correlation attempts, the purchase event will be marked with an error in Segment. This will allow you to replay the event once the user's email has been established.

analytics.track('Product Added', {
"cart_id": "skdjsidjsdkdj29j",
"product_id": "507f1f77bcf86cd799439011",
"sku": "G-32",
"category": "Games",
"name": "Monopoly: 3rd Edition",
"url": "https://www.example.com/product/monopoly",
"brand": "Hasbro",
"variant": "200 pieces",
"price": 18.99,
"quantity": 1,
"coupon": "MAYDEALS",
"position": 3,
"email": "xxxxxxx@example.com",
"clearIncompleteCartAfterNHours": 24
});

Clear Cart After N Hours

When submitting "Product Added" or "Product Removed" events, you will have the optional ability to clear a cart with potentially stale products.  If the clearIncompleteCartAfterNHours property exists, we'll compare the timestamp of the current event payload against the last date that a user profile's cart was updated to determine if their cart has expired.  Product added If the "Product added" call is used and this new payload's date is less than the last payload's date plus the number of hours set in the clearIncompleteCartAfterNHours variable, the product will be added along with the other products that already exist in the cart. If this new payload has a date greater than the last cart update's date plus the number of hours set in the variable, the cart will only have this new item and all old items will be removed. Product Removed If the "Product removed" call is used and the item exists in the cart, the item will be removed. If this new payload has a date that is less than the last cart update's date plus the number of hours set in the clearIncompleteCartAfterNHours, the only product to remove will be the one specified in this call and the rest of the products will remain.  If the date is greater than the last payload's date plus the number of hours set in the variable, the cart will be empty. If the product does not exist, the request will be discarded and retried later by Segment.

Field Mapping

On the order level, we'll capture tax, shipping, and discount automatically as adjustments. To make sure all orders enter exactly once, the integration will use order_id, checkout_id, or Segment's message_id as a unique key for the order.  For line items, URL, title, quantity, price, and tags will all map to content fields, with all other fields appearing as item custom fields. If the item is not already in your Content Library, it will automatically be created from the purchase details. All non-standard fields will be available in order-level and item-level custom fields, all accessible in Audience Builder and Lifecycle Optimizer entries. Note: In order to properly pass date and time information as a timestamp, the following naming and formatting conventions must be used:
  • Dates
    • Value: For dates, such as birthdays, store a string in the date format: YYYY-MM-DD (for example, 2013-12-15). If the year is unknown, set it to 0000 (for example, 0000-12-15).
    • Var name: _date is required at the end of the var name in order for values to be interpreted as dates. (For example, birth_date or first_login_date.)
  • Times
    • Values: For time, such as the moment a user signed up, store in UNIX timestamp format (i.e. the number of seconds since Jan 1, 1970 00:00:00 GMT). For example, 1388087892.
    • Var names: _time is required at the end of the var name in order for values to be interpreted as timestamps. (For example, last_discount_time or signup_time.)

Campaign Attribution

The Segment Integration can automatically attribute purchases to your campaigns and LO flows by adding a new query parameter st_bid to your clickthroughs. These can be automatically enabled in MY at https://my.sailthru.com/settings/email

Track Pageviews, Sessions, and Interest Data

The Destination for Segment consumes all Segment pageviews. By default, pageview tracking relies on interest tags in your Content Library but those can be overridden by passing a tags array in your Segment page() request properties.  The Destination for Segment can also automatically generate connected onsite sessions from your Segment pageview stream, allowing you to use Lifecycle Optimizer's Browse Abandoned and Cart Abandoned entries.



If for any reason you wish to not track Segment pageviews, you can disable this via a toggle in your Segment Destination settings.

Start Lifecycle Optimizer Flows from Segment Events

All other events recorded with Segment's track() API are able to kick off Lifecycle Optimizer flows via the Custom Event (API) entry. Any data passed in a Segment event's properties will be available for entry filters, checks, and accessible in-template.

Contact us

Top