SOLVED

Re: Pass Email Address within a Program token

Go to solution
Yavor_Todorov
Level 3

Pass Email Address within a Program token

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:

https://x.com?email=${lead.Email} 

 

So I created the following:

1. A My.Token(my.email) with this value: https://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 https://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

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Pass Email Address within a Program token

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.

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Pass Email Address within a Program token

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.