Segment is a powerful customer data platform (CDP) for gathering customer data from different sources and distributing it to multiple destinations seamlessly.
This post will give you an introduction to the Segment platform covering these basics:
- How Segment is setup with Sources and Destinations
- The different event types in Segment
- How to test events and debug delivery issues
If you want a recap on the definition of a CDP and how it is different from a marketing automation platform then check out my first post on this topic What is a CDP in Marketing?.
Or if you want to get straight into the nitty-gritty then check out the Segment Marketo Integration post to see how to set up a destination like Marketo and the associated custom activities and fields.
Segment CDP Walkthrough Video
Segment CDP Event Types
- Page: An event for pageviews of your site
- Identify: An event for when someone is identified on your site e.g. they fill out a form, they sign in to your portal
- Track: Bespoke events that you can define and send to Segment
- Screen: An event for when someone views a screen on your mobile app
- Group: An event to associate a user with a group
- Alias: An event to merge two identities
For a more in-depth look into each of these event types, you can take a look at the Segment Spec Overview.
Segment CDP Source Overview
Entering the “Sources” section will reveal all the incoming sources that are contributing data to Segment. Clicking on a particular source will reveal all the destinations that are receiving data from this source in the “Overview” tab. Within a source, two tabs that are useful for testing and insight are the “Debugger” and “Schema” tabs.
Segment CDP Source Debugger
The “Debugger” allows you to see all the event types that are coming into Segment from this source, live, in real time, with different filters and keyword search allowing you to narrow in on certain events.
Selecting a certain event from the Debugger stream will bring up the contents of that event in a pane on the right-hand side. The contents of the event will be in JSON format with the “Pretty’ tab offering a filtered and condensed version of the event information from the “Raw” tab. If you want to edit the contents of this event payload then you will need to talk to the engineers that are responsible for sending this event to Segment from either the front or back end of your site.
In the “Raw” tab you can see the integrations section of the event payload that details all the destinations that will receive information from this event. You can explicitly set each destination to true or false as follows:
"integrations": {
"Destination 1": true,
"Destination 2": false,
"Destination 3": True
}
Alternatively, you can use the “All” key to set the default for all sources and then list exceptions to the rule. In the example below this event will be sent to all destinations except for the Marketo destination.
"integrations": {
"All": true,
"Marketo V2": false
}
Finally, if you want to test sending this event to a particular destination then click on the “Validate” option in the top right-hand corner, which will allow you to select a destination and then bring you to the event tester for that destination. The “Event Tester” will already be populated with the exact contents from the event that you selected (see more in the “Segment CDP Event Tester” section below).
Segment CDP Source Schema
The schema overview is useful for checking that Segment is receiving events as normal from the various different sources.
The graph at the top of the page shows the distribution of the total number of event calls day over day within the time period while the table below the graph shows the event count for all the different events within the time period.
Clicking on a particular event will reveal a day-over-day graph showing the distribution of this event over the time period, while the table below the graph illustrates the number of time event properties were actually present in the event payload. For example, in the image above we see that over the 7-day period, there were a total of 252,383 “Page Viewed” events but only the “path” and “url” properties were present in every single call.
If there are other event properties e.g. “referrer” and “search”, that are also meant to be present in every “Page View” event then you know that not all of the required information is being passed from the front or back end (front end in this case for a page view).
Segment CDP Destination Overview
Segment CDP Event Tester
The “Event Tester” is a handy tool that allows you to send test events to your destination and see exactly what Segment is sending to the destination and the response the destination sends back.
There are two ways to create a test event. You can paste the JSON payload for the event (either Track, Identify, Page, Screen, or Group) in the window. Alternatively, you can use the “Event Builder” tab to build the event from scratch by filling out the event type, name, and properties as well as the user id that the test event is being sent on behalf of.
As mentioned in the “Segment CDP Source Debugger” section above, if you are in the “Debugger” for a source and you click into an event, you can send this event to the “Event Tester” of a destination using the “Validate” option in the top right-hand corner.
Segment Event Lifecycle
Once you press “Send Event” then the “Event Lifecycle” field will populate on the right-hand side of the screen. There is a number in the top right-hand corner that shows how many request-response interactions there were along with arrow keys to page through these different interactions. Within a particular interaction, you can use the “Request from Segment” tab to see the JSON payload of what Segment sent to the destination. The “Response from Destination” tab then shows the JSON payload the destination sent back indicating whether the request was successful.
As an example let’s take a look at an event that Segment would send to the Marketo destination. The first request that Segment will always make is to get the Marketo lead id of the person who carried out the event. Segment will look up the lead id using the email address if it is present (as shown below) or if the email address is not present it can also use a custom id field to look up the lead in Marketo.
Once Segment has obtained the Marketo lead id it then sends a request to the external activities endpoint specifying this lead id along with the primary key value for the Marketo activity and any other event properties that have been mapped to custom activity fields (see the Integrating Segment Events with Marketo Activities section in the “Segment Marketo Integration” post).
Segment CDP Event Delivery
The “Event Delivery” section is useful for checking that events sent to a destination are going through successfully.
The time period for the “Delivery Summary”, “Delivery Trends”, and “Delivery Issues” can be adjusted from 10 minutes to the past 2 weeks. The “Delivery Summary” is useful for getting a snapshot view of average performance over the time period while the “Delivery Trends” graph allows you to dig further and see the times when errors are most prevalent or when latency is highest.
Clicking on a particular delivery issue will bring up a pane on the right-hand side of the screen, which will show up to 20 examples of the sent-request-response interactions related to the delivery error.
You can use the “Event Tester” described above to test out potential fixes and see if the event goes through to the destination successfully.
Segment CDP Destination Filters
Filters can be configured in each destination to either:
- Block events matching certain criteria
- Only allow events matching certain criteria
- Block certain fields coming through under certain criteria
Then when you are defining the matching criteria you have the option to use “is”, “is not”, or “contains” matching in conditions using:
- Event Names
- Event Types
- Event Fields
The filter is configured to either use “ALL” or “ANY” of the conditions specified when making an evaluation.
As shown in the video at the top of this post, when you are configuring the rules for this filter you can load sample events from your Production source or you can paste in event payloads to see if these events would pass the filter. A good way to get the payload for an event is to go to the Debugger for the source sending this event to Segment and copy the payload from here when the event appears.
Get Started with the Segment CDP
Now that you have taken a look under the hood and you know how Segment receives, handles, and distributes the data it receives, it is time to set up a destination in Segment with custom activities and fields!