step
segment
Execute Segment analytics operations.
Overview
Supports operations:
- track: Record user actions
- identify: Record user traits
- page: Record page views
- screen: Record mobile screen views
- group: Associate user with a group
Setup:
1. Create a Segment account at https://segment.com/
2. Create a source in your Segment workspace
3. Copy the Write Key from your source settings
4. Store your write key securely (e.g., as an environment variable: SEGMENT_WRITE_KEY)
Write Key: Required. Get from Segment source settings
- track: Record user actions
- identify: Record user traits
- page: Record page views
- screen: Record mobile screen views
- group: Associate user with a group
Setup:
1. Create a Segment account at https://segment.com/
2. Create a source in your Segment workspace
3. Copy the Write Key from your source settings
4. Store your write key securely (e.g., as an environment variable: SEGMENT_WRITE_KEY)
Write Key: Required. Get from Segment source settings
Examples
Track event
Track a user action or event in Segment
type: segment
write_key: ${env:SEGMENT_WRITE_KEY}
operation: track
user_id: user_12345
event: Purchase Completed
properties:
order_id: order_789
revenue: 99.99
currency: USD
products:
- product_id: prod_abc
name: Premium Plan
output_to: segment_result
Identify user
Create or update user profile with traits
type: segment
write_key: ${env:SEGMENT_WRITE_KEY}
operation: identify
user_id: user_12345
traits:
email: user@example.com
name: John Doe
plan: premium
created_at: 2024-01-15
output_to: identify_result
Track page view
Record a page view event
type: segment
write_key: ${env:SEGMENT_WRITE_KEY}
operation: page
user_id: user_12345
name: Product Details
category: ecommerce
properties:
url: https://example.com/products/123
title: Premium Plan Details
referrer: https://google.com
output_to: page_result
Group user
Associate user with a group/organization
type: segment
write_key: ${env:SEGMENT_WRITE_KEY}
operation: group
user_id: user_12345
group_id: company_abc
traits:
name: Acme Corporation
plan: enterprise
employees: 500
output_to: group_result
Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | No | Step type identifier
Default: "segment" |
write_key | string | Yes | Segment source write key (API key) for authentication |
operation | string | Yes | Segment operation: track (events), identify (user traits), page (page views), group (group traits), or screen (mobile screens)
Options: track, identify, page, group, screen |
user_id | string | No | Unique identifier for the user (required unless anonymous_id is provided) |
anonymous_id | string | No | Anonymous identifier for the user (alternative to user_id for unknown users) |
event | string | No | Name of the event being tracked (required for track operation) |
properties | string | No | Additional properties for the event, page, or screen (custom metadata) |
traits | string | No | User or group traits/attributes (for identify and group operations) |
category | string | No | Category of the page or screen (for page and screen operations) |
group_id | string | No | Unique identifier for the group (required for group operation) |
context | string | No | Additional context about the event (device, app, location, etc.) |
timestamp | string | No | ISO 8601 timestamp when the event occurred (defaults to current time if not provided) |
timeout | integer | No | HTTP request timeout in seconds
Default: 30 |
output_to | string | No | Key name where the API response will be stored in the event
Default: "segment" |
Base Configuration
These configuration options are available on all steps:
| Parameter | Type | Default | Description |
|---|---|---|---|
name | | null | Name of the page or screen (for page and screen operations) |
description | | null | Optional description of what this step does |
retries | integer | 0 | Number of retry attempts (0-10) |
backoff_seconds | number | 0 | Backoff (seconds) applied between retry attempts |
retry_propagate | boolean | false | If True, raise last exception after exhausting retries; otherwise swallow. |