How to set {{lead.ID}} to return on Form Complete or Submit on Web Page using Marketo Embed Form | Community
Skip to main content
New Participant
October 30, 2020
Solved

How to set {{lead.ID}} to return on Form Complete or Submit on Web Page using Marketo Embed Form

  • October 30, 2020
  • 1 reply
  • 2365 views

Hi There, new to board.  

We have marketo embed forms on our site (via CMS, e.g. AEM or SiteCore) and we'd like to track the {{lead.ID}} when the user submits the form.  The thank you pages are not Marketo templates but I have read on these boards that it is possible to return the {{lead.ID}} via JS on a non Marketo templated page, using Marketo embed forms.  

I've tried a few times with no luck.

Example below doesn't seem to fetch the lead.ID

 

$(document).ready(function(){ var test = "{{lead.ID}}"; window.decodedVariable = $('<textarea/>').html(test).text();

 

Does anyone have any guidance around this.  The purpose of tracking lead.id is for Analytics purposes.

 

Thanks in advance & Kind Regards

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

The thank you pages are not Marketo templates but I have read on these boards that it is possible to return the {{lead.ID}} via JS on a non Marketo templated page, using Marketo embed forms. 

This is definitely incorrect out-of-the-box, don't know where you read it.

If  (but only if) you use my separate form Pre-Fill JS you'll be able to read the field from your non-Marketo origin.

 

Note the Lead ID is numeric. There's no need to HTML-decode it, as it's not possible for it to contain characters requiring encoding in the first place.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
October 30, 2020

The thank you pages are not Marketo templates but I have read on these boards that it is possible to return the {{lead.ID}} via JS on a non Marketo templated page, using Marketo embed forms. 

This is definitely incorrect out-of-the-box, don't know where you read it.

If  (but only if) you use my separate form Pre-Fill JS you'll be able to read the field from your non-Marketo origin.

 

Note the Lead ID is numeric. There's no need to HTML-decode it, as it's not possible for it to contain characters requiring encoding in the first place.