SOLVED

Check if lead on page is known

Go to solution
Anonymous
Not applicable

Check if lead on page is known

I'm looking for a simple way to run JavaScript on any page to tell us if the visitor is known. I'm thinking it would likely be some sort of Munchkin value as to whether the visitor is associated, but I can't seem to find anything in the documentation. My only other idea is via the known visitor behavior in the forms, but I would rather not have to load up a form for this.

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Check if lead on page is known

There's no supported to way to get this info, other than using Known Lead HTML in a hidden form (in the KL HTML area itself, add a <script> to set a JS variable or call a function, so you don't need to poll the HTML markup or anything like that).

The unsupported way is to query the /getKnownLead endpoint directly but even with all the crazy things I do with Munchkin and Forms 2.0, that's something I stay away from because it could change without notice.

View solution in original post

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Check if lead on page is known

There's no supported to way to get this info, other than using Known Lead HTML in a hidden form (in the KL HTML area itself, add a <script> to set a JS variable or call a function, so you don't need to poll the HTML markup or anything like that).

The unsupported way is to query the /getKnownLead endpoint directly but even with all the crazy things I do with Munchkin and Forms 2.0, that's something I stay away from because it could change without notice.

Anonymous
Not applicable

Re: Check if lead on page is known

Would there be any potential problems loading a dummy form in a hidden element and running a query for whether or not it's showing up as a known lead?

SanfordWhiteman
Level 10 - Community Moderator

Re: Check if lead on page is known

No problem exactly, but "running a query" implies polling the DOM -- that's not really necessary because you can use a script in the KL HTML (i.e. in the Rich Text area) to set a value. Then check for the value in MktoForms2.whenReady.