Pass Email Address within a Program token | Community
Skip to main content
New Participant
April 21, 2021
Solved

Pass Email Address within a Program token

  • April 21, 2021
  • 1 reply
  • 1972 views

Hello,

 

We have a Marketo landing page with a form. Once the form is submitted, we want to capture the Email Address and pass it to an External page(not Marketo)  in this format:

x.com?email=${lead.Email} 

 

So I created the following:

1. A My.Token(my.email) with this value: x.com?email=${lead.Email} 

2. In the form, I am using {{my.email}} as an Follow up page. 

 

But unfortunately, when I submit the Marketo form, I go to this same URL x.com?email=${lead.Email}  where the email is not replaced.

 

Any idea how to make this work? I checked the email script tokens, but as I can see, I cannot use them in my Form as a follow up.

 

Best regards,

Yavor

Best answer by SanfordWhiteman

There are 2 separate reasons why your attempt wouldn't work:

  1. You can't nest lead tokens within Text {{my.tokens}}. (You can nest lead fields within Velocity {{my.tokens}} but Velocity tokens only work on emails, not on LPs.)
  2. The lead's Email Address field can't be expected to be saved on the server before the Thank You URL redirection occurs, so the {{lead.token}} must be assumed empty. (The save happens at roughly the same time as the redirect, sometimes distinctly after, but must not be expected to be completed before the redirect.)

Luckily, it's very simple to append fields to the Thank You URL using the JS API. Use the code from the JS pane here just before the closing </body> tag:

 

  MktoForms2 :: Append submitted values to TY URL v1.0.0

 

You can customize the fields and their corresponding query param names in the appendFieldsToTYQuery object.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
April 21, 2021

There are 2 separate reasons why your attempt wouldn't work:

  1. You can't nest lead tokens within Text {{my.tokens}}. (You can nest lead fields within Velocity {{my.tokens}} but Velocity tokens only work on emails, not on LPs.)
  2. The lead's Email Address field can't be expected to be saved on the server before the Thank You URL redirection occurs, so the {{lead.token}} must be assumed empty. (The save happens at roughly the same time as the redirect, sometimes distinctly after, but must not be expected to be completed before the redirect.)

Luckily, it's very simple to append fields to the Thank You URL using the JS API. Use the code from the JS pane here just before the closing </body> tag:

 

  MktoForms2 :: Append submitted values to TY URL v1.0.0

 

You can customize the fields and their corresponding query param names in the appendFieldsToTYQuery object.