Autopilot's Segment integration allows you to trigger Journeys from events (called "Tracks" in Segment) in your web or mobile application. You can also send events back to Segment in your Journeys.
How to connect to Segment
1. In Autopilot, navigate to Settings and then under App Connections, click Segment:
2. Click Connect to Segment.
3. You will be asked for the write key. You can locate the write key in Segment under the settings for a source. Go to Workspace, then Select main source, then Settings, then API Keys:
4. Copy the write key into Autopilot and click save.
5. In Segment, under the source, select Integrations and search for Autopilot:
6. Select Autopilot. A right side panel will pop up. Click Settings:
7. Configure the integration in Segment by clicking the API Key field. You will need to enter your API key. You can find the API key here after connecting to Segment in Autopilot:
8. Save, enable and close the Segment integration.
9. In order for Segment to work correctly and associate contacts into your database you will need to configure your field mappings. To do this, click Field Mappings:
10. By default, we require an email address in the Identify. This allows us to have at least one form of communication with the contact. We also recommend including an email address in your Track events. This ensures that if we receive the Identify and the Track event out of order, we'll know which contact to identify the event with.
Configure each Segment property to match the corresponding Autopilot field:
"Property" in this context is used as a general term for a "trait" in the case of an Identify and a "property" in the case of a Track. Track properties will always take priority if there is a matching Track and Identify property.
It's also important to note that your Segment property might be email_address as opposed to Email. Check the event Identify traits before setting this up.
11. You can add more properties to map to Autopilot:
You can map them to existing Autopilot fields, or add new custom fields:
Note that if you need to map objects with more than one tier you can learn how to do so here.
12. When you are finished remember to click "Update Field Mappings" on the right hand side to save your changes.
How to send Identify and Track Events to Autopilot from your web or mobile app
To learn about tracking events using Segment please consult their documentation.
For more examples in different frameworks please consult Segment’s documentation.
How to trigger a Journey based on a Track Event
1. Create a Journey and drop the Segment Event trigger on the canvas:
2. Click on the trigger and enter the event name:
3. You can set the trigger to only start the Journey when the event contains certain properties. For example, below is an example of a trigger that would fire when a plan is "Enterprise".
4. You can then add actions and conditions after the trigger as normal:
5. Publish your Journey and then test it by sending an event to Segment. You will know the event is working as it will be shown in the Activity Feed:
The Activity Feed will only display events that are used in published Journeys.
How to send a Segment event from Autopilot
Here at Autopilot we use Mixpanel to track important metrics for our business. Sometimes during a Journey we want to log key events and visualize the data in Mixpanel. Segment is a great way of achieving this:
By sending events based on actions such as submitting a form we can then visualize these events in Mixpanel:
This is just one example of how sending events from within a Journey can be used in Autopilot. Below we will cover how to send events back to Segment.
To do the above:
1. Add a trigger to your Journey and then the Send Event action:
2. Setup the trigger and then click on the Send Event action:
3. Give the event a memorable name. You can send properties with the event, these property values can use variables from any contact field using -- before a variable and after the variable --.
How Autopilot events handle Identify
When you send an event from Autopilot we will send an Identify along with the event:
If you wish to pass other custom information we recommend you do this through the Events properties:
When will Autopilot add or update contacts from Segment?
A new contact will be added (or new information appended to an existing contact if they already exist) on all identify events. This can be modified in the Advanced Options.
All contacts added via Segment will appear in a list called "Segment Contacts":
Questions? View our article on Troubleshooting Segment.