Hello everyone,
I'm currently in the process of trying to deprecate our use of Segment (an event-handling framework) and move towards a more API-focused approach to working with custom activities. But I'm unclear if I can just use the primaryAttributeValue to index our activity, or if we need to somehow get the leadId to trigger this.
For more specifics, let's say that we want to give people an option to opt out of marketing emails for GDPR compliance. During signup, we would get an email and (our internal) customer id, but I don't know if we've created a lead for them in Marketo yet. In Segment (docs) I would get the Custom Activity ID, determine what field is the primary key, and upload whatever other information is pertinent. So if I know that "myself@me.com" doesn't want an email, I assume that there is something that can figure out which lead has that email and do the necessary actions.
However, when looking through some API documentation (this doc, this ref), it appears that I need to provide *both* a primaryAttributeValue and a leadId. If I want to do a custom activity, do I need to know the leadId in order to make it happen? Alternately, is there a smarter way to handle this sort of event-based behavior besides custom activities?
Thank you in advance,
Paul
Solved! Go to Solution.
Custom Activities — like standard activities — are always linked to a Lead ID. So you must look that up first. Naturally, when sending CAs one-at-a-time, this reduces the max activities you can log in a day, since you’re using one additional API call for whatever you call a session. (Or of course using a periodic Marketo lead export as a cache, but that’s a whole other scene.)
But this isn’t any different from the way other activities work, it’s just that the ID lookup is done automatically in other cases. The activity is still never linked to the Email Address or another field, it’s linked to the ID; when the person with that ID is deleted, the activity is gone. Overall, remember: the Email Address field is not a unique identifier in Marketo. And CAs, COs, standard activities, etc. only relate to a single known record.
A more scalable approach is to use the Munchkin API to log standard activities — either Click Link or Visit Web Page — with a custom URL structure. For example, hit /.custom/payment/portal/change-subscription to indicate an interesting app event. Or use a nightly Bulk Activity Import, which isn’t real-time but has much higher capacity than one-by-one.
Custom Activities — like standard activities — are always linked to a Lead ID. So you must look that up first. Naturally, when sending CAs one-at-a-time, this reduces the max activities you can log in a day, since you’re using one additional API call for whatever you call a session. (Or of course using a periodic Marketo lead export as a cache, but that’s a whole other scene.)
But this isn’t any different from the way other activities work, it’s just that the ID lookup is done automatically in other cases. The activity is still never linked to the Email Address or another field, it’s linked to the ID; when the person with that ID is deleted, the activity is gone. Overall, remember: the Email Address field is not a unique identifier in Marketo. And CAs, COs, standard activities, etc. only relate to a single known record.
A more scalable approach is to use the Munchkin API to log standard activities — either Click Link or Visit Web Page — with a custom URL structure. For example, hit /.custom/payment/portal/change-subscription to indicate an interesting app event. Or use a nightly Bulk Activity Import, which isn’t real-time but has much higher capacity than one-by-one.
Appreciate the response! My (admittedly poor) understanding is that the Munchkin API is a Javascript thing, as opposed to the REST API. Am I correct in this?
I wasn’t sure where your events are being logged. If they’re completely offline, you can still send Munchkin hits: the format is easy to reverse engineer from a web visit.
You do still need to associate the Munchkin unique session ID with a person, but you can do that via a Submit Form REST API call, which — important for your case — can use the Email Address field as the lookup key.