How do I check to see if a cookie is present to specific Marketo ID?

Highlighted
Anonymous
Not applicable

How do I check to see if a cookie is present to specific Marketo ID?

I am embedding a form onto an external website, and there is a button to a form within a modal dialogue to download a PDF. However, if the user is known, and already has '_mkto_trk' cookie (for a particular client), I want to bypass the form and go straight to the PDF. So far I have this, but to no avail! Also, surely the visitor could have the cookie from another marketo user, so unsure of how to grab the ID.

  $('.dl-btn').click(function(event) {

  if (jQuery.cookie('_mkto_trk')) {

      window.location = URL

    } else {

Any help is much appreciated!

3 REPLIES 3
Highlighted
Marketo Employee

Re: How do I check to see if a cookie is present to specific Marketo ID?

Hi Kris,

The presence of the cookie does not imply that a lead is known.  I'd suggest using this method instead: Show Custom HTML Form for Known Leads - Marketo Docs - Product Docs

Highlighted
Anonymous
Not applicable

Re: How do I check to see if a cookie is present to specific Marketo ID?

Hi Kenny, thats great thank you. Is there any way of checking the cookie to see if the lead is known and then redirecting?

Highlighted
Marketo Employee

Re: How do I check to see if a cookie is present to specific Marketo ID?

Sure.  In the custom HTML, you could set up a redirect with javascript.  Something like this:

<script>

document.location.href = "www.example.com"

</script>