> For the complete documentation index, see [llms.txt](https://docs.formsort.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.formsort.com/integrations/integration-reference/segment/segment-cross-domain-tracking.md).

# Segment cross domain tracking

## 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.

<figure><img src="/files/N3uLQX5QZs9iO3HTSuKF" alt=""><figcaption></figcaption></figure>

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>

<img src="/files/MQyOZpsS9SNvfy1t7uHI" alt="" data-size="original">

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

In Formsort's Segment integration settings, toggle on "Use user\_id from answers to identify" option\
![](/files/f9xcmZBKzDXxwofSXdxM)

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

#### Passing via direct link

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.&#x20;

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](https://docs.formsort.com/building-flows/schemas/external-answers).

#### 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](https://github.com/formsort/oss/tree/master/packages/react-embed) package. e.g.

```tsx
<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](https://github.com/formsort/oss/tree/master/packages/web-embed-api#loadflowclientlabel-string-flowlabel-string-variantlabel-string-queryparams-arraystring-string--void). e.g.

```typescript
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
)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.formsort.com/integrations/integration-reference/segment/segment-cross-domain-tracking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
