Integrations and ConnectorsConnectorsSetup GuidesApp Analytics

Segment Connector

This guide covers implementing Descope's segment connector. Segment is an analytics product that allows you to collect events from web and mobile apps. Descope enables you to capture data from Segment to better understand your customer's needs.

Configure Segment connector

Descope uses your Segment Write Key to programmatically send event updates during your authentication flow. Start by navigating to the Descope Segment connector: Connectors then select Segment

Now, complete the required fields:

  • Connector name: Custom name for your connector. This will come in handy when creating multiple connectors from the same connector template.
  • Write Key: The Segment Write Key generated for the Descope service. Read more on how to find it in Segment's documentation. You can also configure the optional fields:
  • Connector description: Describe what your connector is used for.
  • Custom base URL: The base URL of the Segment API, when using a custom domain in Segment.

You can test if your connector's configuration is working properly simply by hitting the Test button and viewing the Test Results panel.

Descope example segment connector configuration

Save your configuration by hitting Create.

Auto Audit Flow Steps

Enable Auto Audit Flow Steps to have Descope send Segment events on its own, without placing the connector in a flow. When enabled, this connector is automatically triggered after every flow step of the types you select below — no need to add it to flows manually.

  • Tracked step types: Choose which kinds of flow steps should trigger an event — Screens, Connectors, Errors, Actions, and/or Conditions.
  • Anonymous ID: The ID associated with your user when you don't know who they are.
  • Include Step Data: When enabled, data about the flow step that triggered the event (such as its step ID or type) is automatically included as additional properties, on top of anything you configure below.
  • Properties: Key/value pairs sent as event properties, for example email{{form.email}}, or flowId{{flowId}}. Use +/- to add or remove rows.
  • Traits: A dictionary of traits you want to record on your user, like email or name.
  • Context: Key/value pairs sent as Segment context data (for example, information about the device, page, or app the event originated from).
  • Integrations: A dictionary of destination-specific options keyed by destination name (e.g. Amplitude (Actions)). Use it to pass destination-specific data such as the Amplitude session ID and device ID.

Additional Step-Type Groups

Note

Each step type can only belong to one group at a time. Once a step type is assigned to a group, it no longer appears as an option when configuring another group.

Since different step types often need different attributes, you can configure more than one Auto Audit Flow Steps group instead of a single set of settings that applies to every tracked step type.

  1. Under Additional step-type groups, click Add group config.
  2. In the new group's Tracked step types field, select one or more step types.
  3. Configure the same fields for this group as described above (Anonymous ID, Include Step Data, Properties, Traits, Context, Integrations).
  4. Click Add group config again to add further groups for the remaining step types.

For example, you could keep Screens in the default group with one set of properties, and add a second group covering Connectors, Errors, and Actions together with a different set of properties.

Add your Segment connector to a flow

Note

This is a manual, per-flow alternative to Auto Audit Flow Steps. Use this if you only want to send an event from a specific point in a specific flow, rather than automatically after every step of a given type.

Navigate to: Flows, choose your flow. Then, tap the create button (designated via the + icon), select Connector, and choose the Segment tracking option you'd like.

Click to set down the connector in your flow editor and fill out the fields:

  • User ID: The unique ID of the user
  • Anonymous ID: The ID associated with your user when you don't know who they are
  • Traits: A dictionary of traits you want to record on your user, like email or name.
  • Integrations: A dictionary of destination-specific options keyed by destination name (e.g. Amplitude (Actions)). Use it to pass destination-specific data such as the Amplitude session ID and device ID.

Start typing in the empty field to view attribute options. For the User ID, you could use the {{user.userId}} field.

Now, link your connector in your authentication flow, making sure it's placed after any required attributes you just chose are defined. Simply by adjusting the attributes and location of the connector, you can track anything from a user sign up/in to the method used for authentication.

Descope example segment connector within flow

That's it! Whenever a user goes through your authentication flow, the Segment connector will be automatically triggered and the event will appear in your Segment workspace.

Handle errors

The Segment connector allows for custom handling of errors. After adding the connector (track or identify) to a flow, you can scroll down to the 'Error Handling' section. There, you can change the error handling from 'Automatic' to 'Custom', then link to a custom error handling flow.

Descope example segment connector error handling configuration within flow

Descope example segment connector error handling connection within flow

Was this helpful?

On this page