SOLVED

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

Go to solution
Jeff_Leong
Level 2

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

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How to set {{lead.ID}} to return on Form Complete or Submit on Web Page using Marketo Embed 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. 

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.

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: How to set {{lead.ID}} to return on Form Complete or Submit on Web Page using Marketo Embed 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. 

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.