Segment
This page describes how to use Census with Segment.

๐Ÿƒโ€โ™€๏ธ Getting Started

In this guide, we will show you how to connect Segment to Census and create your first sync.

Prerequisites

Segment Sync Setup

1. Create or get a Segment Write key

Segment Documentation on Write Keys are here.
  • Create a new HTTP API Source in the Connections page of Segment (found under "Server")
  • Name your connection and optionally label it (We recommend "Census" for ease of debugging)
  • Copy your write key from the saved connection
  • Navigate to the Connections Page of Census, click on the "Add Service" button and select Segment, and past the created token in the designated field
  • Census will convert this right here and now you're all set with the Segment Connection!
Don't worry if the credential here is different!
Note: Census's permissions will be the same as this Segment token.
โ€‹

2. Connect your data warehouse

If you don't already have a data warehouse connected, follow one of our short guides depending on your data warehouse service:
You should now have a connection to Segment and to your data warehouse! Let's start syncing user data.

3. Create your first Model

Now navigate to the Model section of our Dashboard.โ€‹โ€Œ
Here you will have to write SQL queries to select the data you want to join to a Segment User. Here are some ideas of data you should selectโ€Œ.
  • User with product usage properties
  • User with the organization they are associated to
  • User with the classification coming from a User Classification model

4. Create your first Sync

Now head to the Sync page and click the Add Sync buttonโ€Œ.
In the " What data do you want to sync?" sectionโ€Œ
  • For the Connection, select the data warehouse you connected in step 2
  • For the Source, select the model you created in step 3
Next up is the "Where do you want to sync data to?" sectionโ€Œ
  • Pick the name of Segment service from step 1 as the Connection, right now the object we can sync to is limited to Userโ€‹
For the " How should changes to the source be synced?" sectionโ€Œ
  • Update or Create will be preselected as it is supportedโ€‹
  • Pick the right mapping key, we can sync based on userId from the Segment Identify call or to the device: AnonymousId
Finally, select the fields you want to update in the Mapper in the "Which Fields should be updated?" sectionโ€Œ.
  • Here simply map the fields from your model to the Segment User Properties you want to sync to. You can specify specific properties or "Sync All Properties" such that new columns in the source table will be created on the Segment User object according to the normalization rule you apply
    ๐Ÿช„
    โ€‹
The end result should look something like thisโ€‹:
Click the Next button to see the final preview which will have a recap of what will happen when you start the syncโ€Œ.
That's it! In 4 steps, you've connected Segment and started syncing user properties data from your warehouse ๐ŸŽ‰

๐Ÿ—„ Supported Objects

Segment support is pretty straight forward! Let us know if you want Census to support more objects for Segment.
Object Name
Supported?
User
โœ…
Track (Event)
โœ…

Syncing track events

Like most Events, Segment Track Events have the standard set of fields. Though the event type field is the only required field, you should typically set at least all the standard event fields.
  • event (required) - This is the event type field
  • anonymousId or userId (one of these required) - This indicates which user caused or triggered the event
  • timestamp - The time the event occurred. If not provided, Segment will use their server time when the event was received by them (which can be quite different from when it happened, particularly if you're using Census to backfill events).
  • properties - Acts as a Properties bundle. SeeUsing the properties bundle for more information.
  • context and integrations - Optional event context and controls. See Structured Data for more information on how to create objects to map to these fields.
For more information on the meaning of different Segment fields, take a look at their documentation.
โ€‹

๐Ÿ”„ Supported Sync Behaviors

Learn more about all of our sync behaviors on our Core Concepts page.
Behaviors
Supported?
Objects?
Update or Create
โœ…
User
Append
โœ…
Track (Event)
โ€‹Contact us if you want Census to support more Sync behaviors for Segment.

๐Ÿš‘ Need help connecting to Segment?

โ€‹Contact us via [email protected] or start a conversation with us via the in-app chat.