Skip to main content
Level 2
Oct 30, 2020 5:15 AM UTC
Solved

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

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Oct 30, 2020 6:20 AM UTC

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
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Oct 30, 2020 6:20 AM UTC

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.

Translate