1. Overview
Segment is a Customer Data Platform (CDP) that allows you to collect, clean, and control your customer data. It acts as a central hub, gathering user data from various sources (like your website, mobile app, or servers) and routing it to hundreds of other tools for analytics, marketing automation, and data warehousing.
With the GoInsight Segment node, you can seamlessly integrate event tracking and user management into your workflows. This enables you to send critical customer data to Segment based on triggers from other systems, including:
- Tracking Events: Record user actions, such as a user signing up, completing a purchase, or viewing a product.
- Identifying Users: Associate anonymous activity with a known user and update their traits or attributes.
- Managing Groups: Add users to specific groups or accounts to track company-level data.
- Recording Page Views: Track which pages users are visiting on your website or application.
2. Prerequisites
Before using this node, you must have a valid Segment account. You will also need a Source Write Key from one of your HTTP API sources in Segment to authenticate your requests.
3. Credentials
For a detailed guide on how to obtain and configure your credentials, please refer to our official documentation: Credentials Configuration Guide.
4. Supported Operations
Summary
This node provides operations for tracking user events and managing user and group identities within Segment. The following table summarizes the available actions.
| Resource | Operation | Description |
|---|---|---|
| Event Tracking | Track an Event | Record an event performed by a user using Segment track HTTP API. |
| Event Tracking | Track a Page | Record a page view event by sending page information to Segment page HTTP API. |
| User/Group Management | Add a User to a Group | Add a user to a group in Segment using the HTTP API. |
| User/Identity | Create an Identity | Identify a user in Segment by sending user traits to the identify API endpoint. |
Operation Details
Add a User to a Group
Add a user to a group in Segment using the HTTP API.
Input Parameters:
- GroupId: The unique identifier of the group.
Options:
- UserId: The unique identifier of the user to add to the group.
- Traits: The attribute dictionary related to the group, in the form of key-value pairs(e.g, key, value: {"name": "Initech", "industry": "Technology", "employees": 420}).
- Context: context values.
Output:
- Sent (bool): Indicates whether the HTTP request was actually sent to the Segment API.
- ResponseBody (object): The parsed JSON payload returned by the Segment API; may be an empty object if the response contains no JSON or if parsing fails.
- StatusCode (number): Operation result status code:-1 indicates a parameter validation error;500 indicates an internal exception error;Any other value corresponds to the HTTP response status code returned by the API.
- ErrorMessage (string): A descriptive error message when an error occurs; empty string on success.
Create an Identity
Identify a user in Segment by sending user traits to the identify API endpoint.
Options:
- UserId: The unique identifier of the user to identify.
- Traits: The attribute dictionary related to the group, in the form of key-value pairs
- Context: context values.
Output:
- Sent (bool): Indicates whether the HTTP request was actually sent to the Segment API.
- ResponseBody (object): The parsed JSON payload returned by the Segment API; may be an empty object if the response contains no JSON or if parsing fails.
- StatusCode (number): Operation result status code:-1 indicates a parameter validation error;500 indicates an internal exception error;Any other value corresponds to the HTTP response status code returned by the API.
- ErrorMessage (string): A descriptive error message when an error occurs; empty string on success.
Track a Page
Record a page view event by sending page information to Segment page HTTP API.
Options:
- UserId: The unique identifier of the user. Must provide either UserId or AnonymousId.
- Name: The name of the page. Optional.
- Properties: page-related properties. Optional.
- Context: context values.
Output:
- Sent (bool): Indicates whether the HTTP request was actually sent to the Segment API.
- ResponseBody (object): The parsed JSON payload returned by the Segment API; may be an empty object if the response contains no JSON or if parsing fails.
- StatusCode (number): Operation result status code:-1 indicates a parameter validation error;500 indicates an internal exception error;Other values correspond to the HTTP response status code returned by the API.
- ErrorMessage (string): A descriptive error message when an error occurs; empty on success.
Track an Event
Record an event performed by a user using Segment track HTTP API.
Input Parameters:
- Event: The name of the event to track.
Options:
- UserId: The unique identifier of the user. Must provide either UserId or AnonymousId.
- Properties: event properties
- Context: context values.
Output:
- Sent (bool): Indicates whether the HTTP request was actually sent to the Segment API.
- ResponseBody (object): The parsed JSON payload returned by the Segment API; may be an empty object if the response contains no JSON or if parsing fails.
- StatusCode (number): Operation result status code:-1 indicates a parameter validation error;500 indicates an internal exception error;Other values correspond to the HTTP response status code returned by the API.v
- ErrorMessage (string): A descriptive error message when an error occurs; empty on success.
5. Example Usage
This section will guide you through creating a simple workflow to track a "User Signed Up" event in Segment whenever a new user is created in your system.
The workflow will consist of: Start -> Segment: Track an Event -> Answer.
1. Add the Tool Node
- In the workflow canvas, click the "+" button to add a new node.
- Select the "Tools" tab in the pop-up panel.
- Find and select "Segment" from the list of tools.
- From the list of supported operations for Segment, click on "Track an Event" to add the node to your canvas.
2. Configure the Node
- Click on the newly added "Track an Event" node to open its configuration panel on the right.
- Credentials: In the credentials field at the top, click the dropdown menu and select your pre-configured Segment credential.
- Parameters: Fill in the input parameters for the event.
- Event: Enter the name of the event you want to track. For this example, type User Signed Up.
- UserId: Provide the unique identifier for the user who performed the action. You can map this from a previous node, for example, {{start.user_id}}.
- Properties: Enter a JSON object containing additional details about the event. For example, you could provide information about the user's subscription plan: {"plan": "Pro", "signup_source": "Website"}.
3. Run and Validate
- Once all required parameters are correctly filled, any error indicators on the workflow canvas will disappear.
- Click the "Run" button in the top-right corner of the canvas to execute the workflow.
- After a successful run, you can click the logs icon in the top-right corner to view the detailed inputs and outputs of the node, confirming that the event was sent successfully.
After completing these steps, your workflow is fully configured. When executed, it will send a "User Signed Up" event to your Segment source, allowing you to analyze this data in your connected destinations.
6. FAQs
Q: How should I format the Properties or Traits input fields?
A: These fields expect a string containing a valid JSON object. Ensure that your keys and string values are enclosed in double quotes. For example: {"companyName": "Innovate Inc.", "employeeCount": 50}.
Q: What is the difference between UserId and AnonymousId?
A: UserId is a unique identifier for a known, logged-in user (e.g., a database ID). AnonymousId is used to track users before they have signed up or logged in (e.g., a cookie or device ID). For most operations, you must provide at least one of them.
Q: I am receiving a 400 or 401 error. What should I check?
A: An error like this typically points to an issue with your request or credentials. Please check the following:
- Credentials: Ensure your Source Write Key is correct and has the necessary permissions in Segment.
- Required Fields: Make sure you have provided all the required input parameters for the specific operation you are using.
- Data Formatting: Verify that any JSON you are passing in fields like Properties is correctly formatted.
7. Official Documentation
For more in-depth information about the Segment API and its capabilities, please refer to the Segment HTTP API Documentation.
Leave a Reply.