[FE&R] Sending AB Tasty events to Segment

circle-info

Flagship Visitor ID & Segment.io User ID

For the user matching to be achieved (and allow Flagship to target your Segment traits) the User ID sent in the Segment .identify calls must be the same value than the Flagship Visitor ID sent to the decision API.

Refer to the Segment documentation on User ID herearrow-up-right.

This guide explains how to configure AB Tasty server-side events to be forwarded to Segment (SegmentIO).

1

Configure Segment

Retrieve the Segment API key

  1. Log into your Segment Dashboard

  2. Select the relevant Source

  3. Navigate to:

Settings β†’ API Keys
  1. Copy the Write Key

You will use this key when configuring the connector in AB Tasty.

2

Create the Segment Connector in AB Tasty

  1. Go to the Integration Hub in AB Tasty

  2. Create a new SegmentIO Connector (PUSH)

  3. Paste the Segment Write Key

  4. Save the connector

Once created, AB Tasty will be able to forward server-side events to Segment.

3

Visitor ID requirement

For AB Tasty to send events to Segment, the visitor ID must be known by Segment.

This means the visitor must first be identified or tracked by Segment before AB Tasty sends events.

Identify the Visitor in Segment

Example:

analytics.identify('YOUR_VISITOR_ID', {
  email: "[email protected]",
  name: "John Doe"
});

This ensures Segment associates events with the correct user.

Retrieve the Visitor ID from Segment

If Segment is already running on the website, you can retrieve the visitor identifier.

Anonymous ID

window.analytics.user().anonymousId();

User ID (if identified)

window.analytics.user().userId();
4

Send the Visitor ID to AB Tasty

The same visitor ID used in Segment must be used when calling the AB Tasty Decision API.

Example:

visitorId = window.analytics.user().anonymousId()

Then pass it to the Decision API request.

If the visitor ID used by AB Tasty does not match the one known by Segment, the event will not be forwarded to Segment.

5

Event Flow Overview

User β†’ Segment identifies visitor
      ↓
Visitor ID retrieved from Segment
      ↓
Decision API called with same visitor ID
      ↓
AB Tasty generates server-side event
      ↓
Event sent to Segment via connector

Last updated

Was this helpful?