Segment Marketo Integration: Activities & Fields

The Segment documentation does a very good job at getting you up and started with setting up Marketo as a destination. Build on top of this Segment Marketo integration by adding Marketo Custom Activities and Fields so that you can get events and lead field values into Marketo.

The Segment documentation does an excellent job at getting you up and started with setting up Marketo as a destination. Build on top of this Segment Marketo integration by adding Marketo Custom Activities and Fields so that you can get events and lead field values into Marketo.

In particular, this post will help clear up some prickly points like “What is a primary key in a custom activity?” and “Can custom activity fields populate lead fields?”.

In case you missed my first two posts on this topic or need a quick refresher before diving in below take a cheeky glance at these posts:

Marketo Custom Activities

Primary Key & Other Custom Activity Fields

Before diving into the creation of a custom activity in Marketo and mapping this activity to a Segment event, it is best to start by explaining the primary key and how properties of the Segment activity map to fields on the custom activity.

The custom activity primary key, designated by the asterisk in the image below, is the field that will always be present in the event properties sent from Segment. As explained by Justin Norris, the primary key for a Marketo activity usually refers to the object that the activity refers to:

  • For “Visits Web Page” the primary field would be “web page”
  • For “Fills out Form” the primary field would be “form”
  • For “Opens Email” the primary field would be “email”

So for example in the images below a more applicable primary field could have been “number” for the “Number Search” custom activity, provided that the event sent from Segment always has a “number” property present.

As you see in the images though, the “timestamp” property from the Segment event was used as the primary field and you can see how it is displayed as the primary constraint on the trigger and filter for the custom activity. When you are merely trying to trigger or filter for the custom activity the value of this primary constraint does not matter, hence why the “is not empty” condition is used in the images below.

Consequently, the choice of primary field does not matter so long as it is always present in the Segment event properties being sent to Marketo allowing the custom activity to work correctly.

Marketo Custom Activity Fields
Marketo Custom Activity Fields
Marketo Custom Activity Trigger & Filter
Custom Marketo Activity Trigger and Filter Showing Available Constraints

You only need to have the primary key set and mapped to a Segment event property for the custom activity to function correctly. However, if you want to have additional constraints available on the custom activity filters and triggers then you will need to create a field on the custom activity (see below) for each Segment event property you want as a constraint.

N.B. It is not possible to update Marketo lead fields with the values that come into the custom activity fields from Segment event properties. You can read more about this in this Marketo forum post.

Creating a Marketo Custom Activity

Marketo Custom Activity Details
Marketo Custom Activity Details
  1. Navigate to “Admin” > “Marketo Custom Activities”
  2. Click on “New Custom Activity”
  3. Fill out the “Display Name” and modify the “API Name” if you wish
  4. Click “Next”
  5. Fill out the “Filter” and “Trigger” names
  6. Click “Next”
  7. Fill out the “Name” and “API Name” of the primary field
  8. Click “Submit”

For any additional Marketo fields that you want to map to properties of the Segment event:

  1. Navigate to the “Fields” tab
  2. Click “New Field”
  3. Select the field “Data Type”
  4. Enter a “Name”
  5. Rename the “API Name” field if you wish
  6. Hit “Save”

Finally, to approve the custom activity and get the “Marketo Custom Activity ID” for Segment:

  1. Click the “Custom Activity Actions” dropdown
  2. Select “Approve Activity”
  3. Copy the Custom Activity ID that appears once the activity is approved

Mapping a Marketo Custom Activity to a Segment Event

Segment Marketo Integration Custom Activity Mapping
Marketo Custom Activity Mapping in Segment

Once the Custom Activity has been created in Marketo then follow the steps below to map a Segment event to this custom activity.

  1. Navigate to “Connections” > “Destinations”
  2. Click into your Marketo destination
  3. Click on “Marketo Custom Activities”
  4. Click on “Add Another Event”
    • If you already have existing custom activities then you will have to scroll past these to see this button
  5. Fill out the “Segment Event Name”
  6. Paste in the “Marketo Custom Activity ID” obtained from the previous section
  7. Fill out the “Segment Property Name” that you want to map to the primary key you designated in Marketo
  8. Fill out the “Marketo Field Name” using the API name of the primary key
  9. Select the “Marketo Field Type”
  10. Select the “Set as Primary Key”
  11. Select “Add Another segmentProperty” and repeat steps 7-9 for every additional Segment event property you want to map to a Marketo custom activity field
  12. Click “Save”
    • If you already have existing custom activities then you will have to scroll up past these to see this button

N.B. All the properties for a Segment event can be found by searching for the event in the “Schema” section of the source responsible for sending this event to Segment. Once you have found the event and clicked into it you will see all the properties present in its payload. For more info check out the Segment Source Schema of the “Segment CDP with Marketo MAP Overview” post.

Marketo Custom Fields

Segment Marketo Integration Custom Field Mapping
Marketo Custom Field Mapping in Segment

The “Marketo Custom Fields” section is used for mapping the traits in Segment “Identify” events to Marketo fields. Every time you add new traits to the identify payload being sent from the backend or frontend to Segment make sure that you complete this mapping or else the Marketo field will not be updated when the Identity event gets sent to Marketo.

All that is required to complete the mapping is to include the “Segment Trait Name”, the “Marketo Field Name” (the API name of the field), and the “Marketo Field Type”. Once this is done successfully for each field, a lead in Marketo will either be created or updated with these values from Segment every time an Identity event is sent to Marketo.

What’s Next?

Young padawan your journey has just begun!


Tyron Pretorius

Automating with APIs, Python, Zapier, and Google Scripts 

Former engineer turned marketing operations lead who loves to get down and dirty with the Marketo API, Python, Zapier, and Google Scripts.

Post a comment