> For the complete documentation index, see [llms.txt](https://docs.optibase.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.optibase.io/integrations/segment.md).

# Segment

### Setup

1. Go to your **Segment workspace** → **Connections** → **Sources** → **Add Source**
2. Search for **HTTP API** and select it
3. Give the source a name (e.g. `Optibase`) and click **Add Source**
4. Copy the **Write Key** from the source overview page
5. Go to your **Optibase dashboard** → **Settings** → **Integrations**
6. Find the Segment section and click **Connect**
7. Paste your **Write Key** and select the region of your Segment workspace
8. Click **Connect**

The Segment workspace region defaults to **United States (US)**. If your Segment workspace is EU-based, select **Europe (EU)** to ensure data is routed to the correct regional endpoint. See [Regional Segment | Twilio](https://www.twilio.com/docs/segment/guides/regional-segment) for how to set up an EU workspace in Segment.

***

### Event Details

Optibase sends data to Segment server-side via the HTTP API source. Three types of calls are made automatically — no additional code is required on your page.

#### Identify

Sent when a visitor is seen for the first time.

| Field         | Value                          |
| ------------- | ------------------------------ |
| `anonymousId` | Optibase's internal visitor ID |
| `userId`      | Your own user ID (if provided) |

Context is also included where available.

***

#### Experiment Viewed

Sent when a visitor is assigned a variant for the first time.

| Property     | Description                         |
| ------------ | ----------------------------------- |
| `test_id`    | The ID of the A/B test              |
| `variant_id` | The variant assigned to the visitor |

***

#### Conversion Triggered

Sent when a visitor triggers a conversion event.

| Property          | Description                                                        |
| ----------------- | ------------------------------------------------------------------ |
| `conversion_id`   | The conversion's ID in Optibase                                    |
| `conversion_type` | The type of conversion (e.g. `CLICK`, `PAGE_VIEW`, `PROGRAMMATIC`) |
| `origin_url`      | The page where the conversion occurred                             |

If a conversion is configured as **one per visitor**, duplicate events are suppressed and Segment will only receive the first conversion per visitor.

***

### Using the Data in Segment

Once connected, experiment data is available across your Segment workspace like any other source. You can connect your HTTP API source to a variety of destinations to further analyse the data — including analytics platforms, data warehouses, CRMs, and marketing tools.

All events — Identify, Experiment Viewed, and Conversion Triggered — are forwarded automatically to any destination connected to your HTTP API source. No additional configuration in Optibase is required.
