SOLVED

Re: Possible to detect if a lead is already associated before calling associateLead with Munchkin?

Go to solution
Jon_Wu
Level 4

Possible to detect if a lead is already associated before calling associateLead with Munchkin?

I'm just implementing Munchkin now, but I'm wondering if I can figure out if associateLead needs to be called. I have a variety of ways of detecting who the current user is on my site such as through cookies or localStorage. I want to avoid making superfluous calls to associateLead to reduce requests to Marketo and also to reduce requests to a server side hash function which will generate more load.

Is there a way to know if a lead has been associated already or is my best bet to write a cookie after I associate the lead to track that I've already done it?
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Calvin_Lam
Level 4

Re: Possible to detect if a lead is already associated before calling associateLead with Munchkin?

If you set the Munchkin code to not track anonymous lead on your site, then only known leads should have a cookie.  In this case, you can make the assumption that associateLead was probably called before (or a Mkto form fill out).  It will not deal with the situation where cookie is deleted but this will still reduce the associateLead call by a lot.

If you do need to track anonymous leads, then your proposal of writing your own cookie will be the best solution as there is not much info in _mkto_trk cookie to tell you whether this is a known lead or not without doing a lookup.

View solution in original post

2 REPLIES 2
Calvin_Lam
Level 4

Re: Possible to detect if a lead is already associated before calling associateLead with Munchkin?

If you set the Munchkin code to not track anonymous lead on your site, then only known leads should have a cookie.  In this case, you can make the assumption that associateLead was probably called before (or a Mkto form fill out).  It will not deal with the situation where cookie is deleted but this will still reduce the associateLead call by a lot.

If you do need to track anonymous leads, then your proposal of writing your own cookie will be the best solution as there is not much info in _mkto_trk cookie to tell you whether this is a known lead or not without doing a lookup.

Jon_Wu
Level 4

Re: Possible to detect if a lead is already associated before calling associateLead with Munchkin?

Thanks Calvin. I'll go with the suggestion of adding my own info to track whether the lead is associated or not since anonymous lead tracking is important to me.

Even better, I'm now looking for _mkto_trk before Munchkin initializes so I can know to call associateLead immediately if I know the user's email and this is the first time Marketo has seen them.