Autopilot: Setup - Segment Source
You can stream all email events to Segment by connecting Autopilot as a source. Segment will then forward these events to your destinations, and load them into your data warehouse.
How to connect
Follow the steps below to connect:
For details on the events and their properties please see Segment's documentation.
If you haven't already done so, we recommend also connecting Autopilot as a Segment Destination which will allow you to:
- add and update contacts in Autopilot via Segment;
- trigger Journeys using events that occur in your web or mobile app; and
Please note that the Segment Source Write Key is different to the one used in the Segment Destination setup.
How does it work?
We will send email events to Segment in the format below:
analytics.track({anonymousId: 'thomas@tankengine.com',userId: '12345',event: 'Email Delivered',properties: {campaign_id: 'campaign_CBD5C1FA-3532-42AB-B498-7A93F9CCC72B',campaign_name: 'Onboarding Journey',email_id: 'batchcampaign_1477963234959-639D1900-9FD1-11E6-95FC-1DF74FF397DB',email_name: 'First Onboarding Email',email_subject: 'Welcome to Autopilot',transactional: false}});
The User ID will be determined based on whether we've received an Identify or Track call for the contact in the past. If we have, we'll send out the User ID as it was provided to us in the most recent incoming call. Otherwise, if the contact has never passed through Autopilot, we will not send out a User ID; instead we will send the contact's email as the Anonymous ID.
Please note that the references to "campaign" in "campaign_id" "campaign_name" refer to the Journey. We use this format to comply with Segment's email events spec.