This preview of pull request 1639 is meant for internal use only.

Seg Destination

Seg quick info

Seg accepts Page, and Identify calls. If you reference it in the Integrations object, call it “Seg”.

Seg accepts cloud-mode data from all Segment source types. It does not offer device-mode connections.

This destination is maintained by Seg.

Identify

When you call identify on analytics.js, we pass all traits into Seg. You must provide a traits.email for Seg to identify your customers, otherwise they are effectively anonymous until a traits.email is specified.

Track

When you call track, Seg looks for standard Segment e-commerce event names and they get mapped to standard Seg ecommerce event names as follows:

All other event names are ignored by Seg as there is no logical map.

Augmenting the Segment Ecommerce Spec for Seg

Seg requires some extra information on the above events for full functionality (although Seg will remain nearly fully functional if not further changes are made).

The changes that are recommended are as follows:

  • Include “Brands” and/or “Categories” arrays to all events, for example
analytics.track('Viewed Product Category', {
category: 'Games',
categories: ['Games', 'Board Games'], // This would be all categories (and parent categories) that the product exists in
brands: ['Hasbro']
});
  • Include extra properties to Order Completed , for example
analytics.track('Order Completed', {
orderId: '50314b8e9bcf000000000000',
total: 30,
revenue: 25,
shipping: 3,
tax: 2,
discount: 2.5,
coupon: 'hasbros',
currency: 'USD',
repeat: true,
delivery_method: 'Standard shipping',
_p: 15, // This is the (estimated) profit for the order
products: [
{
id: '507f1f77bcf86cd799439011',
sku: '45790-32',
name: 'Monopoly: 3rd Edition',
price: 19,
quantity: 1,
category: 'Games',
categories: ['Games', 'Board Games'],
brands: ['Hasbro'],
image_url: 'http://example.com/url-to-product-image';,
original_price: 19.99,
variant_name: 'Product Variant Name'
}
]
});
  • Include an extra 5 properties to Viewed Product, Added Product and Order Completed, for example
analytics.track('Viewed Product', {
id: '507f1f77bcf86cd799439011',
sku: '45790-32',
name: 'Monopoly: 3rd Edition',
price: 18.99,
category: 'Games',
categories: ['Games', 'Board Games'],
brands: ['Hasbro'],
image_url: 'http://example.com/url-to-product-image';,
original_price: 19.99,
variant_name: 'Product Variant Name'
});

— or —

analytics.track('Order Completed', {
orderId: '50314b8e9bcf000000000000',
total: 30,
revenue: 25,
shipping: 3,
tax: 2,
discount: 2.5,
coupon: 'hasbros',
currency: 'USD',
repeat: true,
delivery_method: 'Standard shipping',
_p: 15,
products: [
{
id: '507f1f77bcf86cd799439011',
sku: '45790-32',
name: 'Monopoly: 3rd Edition',
price: 19,
quantity: 1,
category: 'Games',
categories: ['Games', 'Board Games'],
brands: ['Hasbro'],
image_url: 'http://example.com/url-to-product-image';,
original_price: 19.99,
variant_name: 'Product Variant Name'
}
]
});

Page

When you call track, Seg will augment the Segment track call with the page url and title. Events will be matched to the current user.

Alias

Our alias method can be used from your server to “re-identify” an existing user identity to a new one. Most of the time this happens when you identify a visitor changes their email address after they opt in.

To connect the two identities you’ll need to alias their current identity to their new one.

Here’s an example of using alias to update the identity from an old email address to a new email address:

analytics.alias('old-email@segment.com','new-email@segment.com')

If both parameters are not email address types, the call is ignored in Seg.

Personas

You can send computed traits and audiences generated using Segment Personas to this destination as a user property. To learn more about Personas, contact us for a demo.

For user-property destinations, an 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, Personas 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), Personas sets that value to false.

When you first create an audience, Personas 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.

Supported Sources and Connection Modes

Before you start, make sure Seg supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode ⬜️ ⬜️ ⬜️
☁️ Cloud-mode

Segment offers an optional Device-based Connection Mode for Mobile data going to Seg, so that you can use Seg features that collect data directly from the mobile device. To do this, you must package the Segment-Seg mobile SDK with the Segment mobile library.

Settings

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

Website Id

You can find your Website Id under your Seg app settings > Web tracking code. It should look like abc8fb18-7559-4324-9921-a4b5015b4a1c. Note that you do not need to install any extra tracking code.

This page was last modified: 07 Apr 2020



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account