Segment cross domain tracking

Track responders in Segment across domains

Overview

If you would like to track Segment users across multiple domains e.g:

  • Site 1: https://www.example.com

  • Site 2: https://www.flow.example.com (the domain hosting the Formsort flow)

You must explicitly set and pass the responder UUID from the top level domain to the one hosting the Formsort flow. This can be done for both with a direct link deployment or an embedded flow.

Setup

Step 1: Add the responder_user_id as an external variable

Navigate to the variable tab inside of a flow and add an external variable.

Name the variable "responder_id" and set the data classification toggle to responder_user_id. This variable will be used to pass the responder id as a query parameter from https://www.example.com to https://www.flow.example.com

Step 2: Set external user id as identifier in Segment integration settings

Step 3: Pass the responder id as a query parameter to responders hitting the flow

After deploying the flow with the variable set in Step 1, you can now pass a Segment user id into the flow as a query parameter.

For example this may look like:

https://flow.example.com/client/{{your_account_name}}/flow/{{your_flow_name}}/variant/{{your_flow_variant_name}}/?responder_id={{segment_user_id}}

To read more about how external variables work, read this documentation.

Passing via embed

If you want to enable cross domain tracking in an embedded flow, you can pass responder_id via query_params in our react-embed package. e.g.

<EmbedFlow
  clientLabel="client"
  flowLabel="onboarding"
  queryParams={[['responder_id', '<value>']]}
  embedConfig={{
    origin: "https://flow.example.com", // if you use custom domains
  }}
/>

If you don't use react, you can do the same using our web-embed-api. e.g.

const embed = FormsortWebEmbed(rootEl, {
  origin: "https://flow.example.com", // if you use custom domains
});

embed.loadFlow(
  'client', // client label
  'onboarding', // flow label
  'main', // variant label - optional
  [['responder_id', '<value>']] // query params
)

Last updated