Is it possible to call getLead using the mkt_tok from a dynamic email?

Anonymous
Not applicable

Is it possible to call getLead using the mkt_tok from a dynamic email?

I am using the SOAP API to look up users landing on resource pages on our site, and update their Marketo record when an interesting moment happens.

For most users, using the _mkto_trk cookie works, and I can look them up using the getLead API method with a key type of "COOKIE".

I can't find a way to efficiently look up users who land on our site from an email campaign, however. The user's cookie gets updated to match their lead record once the munchkin script runs on the page, however, that's too late to serve up personalized content on their first page view.

I've tried several ways to look up the user from the mkt_tok query string parameter, but I can't get a result back from the API. I've looked through the munchkin script to see how the cookie is derived from the URL component, but it isn't immediately obvious, especially since I only have the uglified script to read through.

How can this be done? I'd like to detect if the user is recognized in Marketo and pull their lead information before rendering the page, so waiting until the page renders and the munchkin script runs is not an ideal solution.
Tags (1)
2 REPLIES 2
Anonymous
Not applicable

Re: Is it possible to call getLead using the mkt_tok from a dynamic email?

Than
We do not support pulling the info from mkt_tok which is campaign specific.  Have you tried using snippets and segmentation to display the right content to your users?  Happy to discuss/brainstorm solutions with you 

Raj (rrajamani@marketo.com)
Anonymous
Not applicable

Re: Is it possible to call getLead using the mkt_tok from a dynamic email?

Raj,

Thanks for the pointers. I looked briefly into using snippets, but it looks like those need to run on the Marketo landing page. I'd like a solution that could run on our site before loading the landing page.

It looks like there are functions in munchkin.js that retrieve a lead ID from a URL token. Is there any way of calling those directly?

To clarify our use case:

- all of our gated content is managed and served by our CMS (WordPress)
- when a user requests a gated asset, we use the Marketo API to look them up using getLead and the user's cookie
- if the user is not a known lead, or if their lead record is not complete, we load a Marketo landing page in an iframe.

This breaks down when previously uncookied users land on these asset pages from marketing emails.

I've found two partial solutions that might work:
- By the second page load (after munchkin.js runs once), these users can be be looked up by their cookies. I've considered adding an intermediate page, or at least delaying the API call until the munchkin script runs.
- I can pass the token parameter from the parent page to the landing page iframe, and get at least a prefilled form for these users.

The first is undesirable because it adds another couple seconds to an already slow user experience, and the second isn't ideal, because if we already know who someone is, I'd rather not make them confirm it at all.

I guess I'm just looking for a quicker way of identifying the user from the token. Do you have any suggestions?