Searching leads by cookie yields nothing

Anonymous
Not applicable

Searching leads by cookie yields nothing

I have a web page with form that submits data to Marketo (user name and email.) Later, when I am trying to retrieve lead information using cookie that has been created for that page via API, I get nothing; however searching for emails and names input from that for via lead database UI shows that they've been saved, and if I use lead id from UI in my API instead of cookie, I get the complete info.

Can anyone please tell me where did I go wrong?

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Searching leads by cookie yields nothing

Does the web page load Munchkin?  Can you give an example of the Munchkin cookie you're retrieving and searching on?

Anonymous
Not applicable

Re: Searching leads by cookie yields nothing

Cookie I am trying to use looks like id:111-ABC-222&token:_mch-sitename.domain-1440077784604-36440

Munchkin is (i hope) loaded with this JS:

$.ajax({

  url: '//munchkin.marketo.net/munchkin.js',

  dataType: 'script',

  cache: true,

  success: function() {

    Munchkin.init('111-ABC-222');

  }

});

Anonymous
Not applicable

Re: Searching leads by cookie yields nothing

Hi Egor,

I'm a little confused as to where you are trying to find the record by cookie Id, but I don't think it works from the Lead Database section within Marketo. Also, I'm not sure if you are using the REST or SOAP API. In any case, hopefully this info helps: 

For SOAP:

Are you passing the optional 'marketoCookie' parameter when creating records with your API form?   If not, you may be creating disassociated lead records that won't have page visit history.

syncLead » Marketo Developers

For REST:

I haven't done this in REST so perhaps Sanford Whiteman can confirm, but you may need 2 API calls.

The first to create a record or update the record:

Create/Update Leads » Marketo Developers

There is another API call to associate a lead record with a cookie id here:

Associate Lead » Marketo Developers

In both cases, the end result should be a newly created lead that also has the anonymous activity.

Hope it helps!

Anonymous
Not applicable

Re: Searching leads by cookie yields nothing

Hi Egor,

Marketo stores the cookie with just the "Token" portion.  So for your example If you search with just "_mch-sitename.domain-1440077784604-36440" you'll get what you're looking for.

If you need to verify that a token is set on the lead, you can look up the lead by id # via REST and request "Cookies" in fields

https://111-abc-222.mktorest.com/rest/v1/lead/##Leadid##.json?access_token=##AccessToken##&fields=Co...

Hope that helps,

Josh

Kenny_Elkington
Marketo Employee

Re: Searching leads by cookie yields nothing

The field is actually case sensitive, so it's "cookies"