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.
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
- Navigate to “Admin” > “Marketo Custom Activities”
- Click on “New Custom Activity”
- Fill out the “Display Name” and modify the “API Name” if you wish
- Click “Next”
- Fill out the “Filter” and “Trigger” names
- Click “Next”
- Fill out the “Name” and “API Name” of the primary field
- Click “Submit”
For any additional Marketo fields that you want to map to properties of the Segment event:
- Navigate to the “Fields” tab
- Click “New Field”
- Select the field “Data Type”
- Enter a “Name”
- Rename the “API Name” field if you wish
- Hit “Save”
Finally, to approve the custom activity and get the “Marketo Custom Activity ID” for Segment:
- Click the “Custom Activity Actions” dropdown
- Select “Approve Activity”
- Copy the Custom Activity ID that appears once the activity is approved
Mapping a Marketo Custom Activity to a Segment Event
Once the Custom Activity has been created in Marketo then follow the steps below to map a Segment event to this custom activity.
- Navigate to “Connections” > “Destinations”
- Click into your Marketo destination
- Click on “Marketo Custom Activities”
- Click on “Add Another Event”
- If you already have existing custom activities then you will have to scroll past these to see this button
- Fill out the “Segment Event Name”
- Paste in the “Marketo Custom Activity ID” obtained from the previous section
- Fill out the “Segment Property Name” that you want to map to the primary key you designated in Marketo
- Fill out the “Marketo Field Name” using the API name of the primary key
- Select the “Marketo Field Type”
- Select the “Set as Primary Key”
- 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
- 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
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.
Young padawan your journey has just begun!