> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runalloy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Segment

> Integration details and setup guide for the Segment connector in Alloy Automation.

## Pre-Built Tooling

| Category                            | Details                          |
| ----------------------------------- | -------------------------------- |
| **Authentication**                  | Basic Authentication (Write Key) |
| **Two-Way Sync**                    | No (Data flows into Segment)     |
| **Events Supported**                | No                               |
| **Realtime**                        | Yes                              |
| **Supports Rate Limiting**          | Yes                              |
| **Authentication Scopes Supported** | N/A (Write Key-based)            |

***

## Objects Supported

Alloy Automation supports sending the following event types to **Segment**:

* **Track Events** - User actions and behaviors
* **Identify Events** - User profile information
* **Page Events** - Page views
* **Screen Events** - Mobile screen views
* **Group Events** - Account-level data
* **Alias Events** - User identity mapping

***

## Set Up Guide

### Trial Access

| Question                                           | Answer                                                                                                                   |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| **Offers free trial?**                             | Yes. Segment offers a free tier with 1,000 visitors/month and 2 sources. [Sign up for free](https://segment.com/signup/) |
| **Requires paid sandbox**                          | No. The free tier can be used for development and testing.                                                               |
| **Requires partnership to obtain authentication?** | No. Anyone can create a Segment account and obtain API keys.                                                             |

***

### Authentication (Write Key)

Segment uses a Write Key for server-side authentication. This is a simple API key approach.

<step>
  ## Step 1: Create a Segment Account

  1. Visit **Segment** ([https://segment.com/](https://segment.com/))
  2. Click **Get Started** or **Sign Up**
  3. Create your account with your email and password
  4. Complete the onboarding questionnaire
  5. You'll be redirected to your Segment workspace
</step>

<step>
  ## Step 2: Create a Source

  1. In your Segment workspace, navigate to **Connections** > **Sources**
  2. Click **Add Source**
  3. Select a source type (choose **HTTP API** for server-side integrations)
  4. Name your source (e.g., "Alloy Integration")
  5. Click **Add Source**
</step>

<step>
  ## Step 3: Retrieve Your Write Key

  1. After creating the source, you'll see the source settings page
  2. Copy the **Write Key** displayed on the page
  3. The Write Key format looks like: `abc123xyz456...`
  4. Keep this key secure—it allows sending data to your Segment workspace
</step>

<step>
  ## Step 4: Configure Alloy Automation

  1. In Alloy Automation, configure your Segment connector
  2. Provide your **Write Key** as the authentication credential
  3. The Write Key will be used for Basic Authentication (username field, password left empty)
  4. Test the connection by sending a test event
</step>

***

## Use Cases

### 1) Unified customer data pipeline

Send user behavior events from your application to Segment, which then routes the data to downstream tools like analytics platforms, marketing automation, and data warehouses, creating a single source of truth.

### 2) Cross-platform user tracking

Track user actions across web, mobile, and server-side applications by sending events to Segment from multiple sources, enabling comprehensive user journey analysis.

### 3) Real-time personalization triggers

Send identify and track events to Segment when users perform specific actions, triggering personalized experiences in marketing tools, email platforms, or in-app messaging systems.

### 4) Product analytics enrichment

Enhance product analytics by sending custom events with detailed context (user properties, product interactions, feature usage) to tools like Amplitude, Mixpanel, or Heap via Segment.

### 5) Customer lifecycle automation

Trigger lifecycle workflows in CRM and marketing automation platforms by sending key milestone events (signups, activations, churns) through Segment's event routing.

***

## API Gotchas

* **Event Batching:** Segment supports batch API calls to send multiple events in a single request. Use batching for high-volume scenarios to reduce API overhead and improve throughput. Batch size limit is 500 KB or 15,000 events per request.

* **Timestamp Handling:** Segment accepts an optional `timestamp` field for events. If omitted, Segment uses the time the event was received. For historical data imports or delayed events, always include an explicit ISO 8601 timestamp.

* **User Identity Resolution:** Segment uses `userId` and `anonymousId` to track users. For logged-in users, always send `userId`. For anonymous users, send `anonymousId`. Use the `alias` call to merge anonymous and identified user profiles.

* **Event Naming Conventions:** Follow Segment's event naming best practices: use Title Case (e.g., "Order Completed"), keep names concise, and avoid past tense. Consistent naming ensures proper routing and analysis in downstream tools.

* **Rate Limiting:** Segment enforces rate limits based on your plan. The free tier allows up to 1,000 visitors/month. Higher tiers support more volume. If you exceed limits, requests will be throttled or rejected with 429 status codes.

> For questions or troubleshooting, contact **[support@runalloy.com](mailto:support@runalloy.com)**.
