Segment Diagram

Overview of the Segment-Marketo Relationship

Level 9 - Champion Level 9 - Champion
Level 9 - Champion

Segment DiagramSegment Diagram


Segment is a powerful platform for gathering customer data from different sources and distributing it to multiple destinations, such as Marketo, seamlessly. If you have bespoke data sources e.g. activities from your portal, that you cannot get into Marketo using the launchpoint service then Segment is your knight in shining armour!


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 The difference between Marketo and a CDP.


Or if you want to get straight into the nitty-gritty then check out the Integrating Marketo with Segment post to see how to set up Marketo custom activities and fields.


The Segment PlatformThe Segment Platform


Segment Event Types


  • Page: An event for pageviews of your site
  • Identity: 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 identity types you can take a look at the Segment Spec Overview.


Segment Source Overview


Entering the “Sources” section will reveal all the incoming sources that are contributing data. Clicking into 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.


Source Debugger


Segment Source DebuggerSegment 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.


Segment Debugger Event Detail PaneSegment Debugger Event Detail Pane


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 Event Tester” section below)


Source Schema


Segment Source Schema OverviewSegment Source Schema Overview


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.


Segment Source Schema Event DetailSegment Source Schema Event Detail


Clicking into a particular event will reveal a day over day graph showing the distribution of this event over the time period, while the table below 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).


Marketo Destination Overview


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, Identity, 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 Source Debugger” section above, if you are in the “Debugger” for a source and you click into an event, then you can send this event to the “Event Tester” of a destination using the “Validate” option in the top right-hand corner.


Segment JSON Event TesterSegment JSON Event Tester


Segment Event Tester BuilderSegment Event Tester Builder


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.


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 lookup the lead id using the email address if it is present (as shown below) or it if the email address is not present it can also use a custom id field to lookup the lead in Marketo.


Segment Event Lifecycle First Segment RequestSegment Event Lifecycle First Segment Request


Segment Event Lifecycle First Marketo ResponseSegment Event Lifecycle First Marketo Response


Once Segment has obtained the 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 custom activity and any other event properties that have been mapped to custom activity fields (see the Marketo Custom Activities section in the “Integrating Segment with Marketo” post).


Segment Event Lifecycle Second Segment RequestSegment Event Lifecycle Second Segment Request


Segment Event Lifecycle Second Marketo ResponseSegment Event Lifecycle Second Marketo Response


Event Delivery


Segment Event Delivery Summary & TrendsSegment Event Delivery Summary & Trends


Segment Event Delivery IssuesSegment Event Delivery Issues


The “Event Delivery” section is useful for checking that events sent to this 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 into 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.


Segment Event Issue Detail PaneSegment Event Issue Detail Pane


A lot of the errors you will see are out of your control. They are due to Segment not adhering to Marketo’s API limits and protocols e.g. the 6XX errors below, or system issues between Segment and Marketo e.g. the non 6xx errors below. All of the errors below are usually temporary meaning when Segment later retries sending the event it should go through successfully.


  • 601: Access Token Invalid
  • 602: Access Token Expired
  • 606: Max rate limit of 100 requests per 20 secs exceeded
  • 615: Max concurrency rate of 10 concurrent calls exceeded
  • Etimedout
  • 502 Bad Gateway
  • Econnreset


Instead, focus on error codes that you do have the power to fix e.g. 1XXX or “Message Rejected”. The “Message Rejected” error for example occurs because there is an event being sent to Marketo that has not been mapped to a custom activity or does not include all of the required properties e.g. the primary key (see the Marketo Custom Activities section in the “Integrating Segment with Marketo” post)


You can use the “Event Tester” described above to test out potential fixes and see if the event goes through to the destination successfully.


What's Next


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 setup Marketo custom activities and fields so that you can get this juicy info into Marketo!



The content in this blog has been reviewed by the Community Manager to ensure that it is following Marketing Nation Community guidelines. If you have concerns or questions, please reach out to @Jon_Chen or comment down below.