SOLVED

Send email over URL using Marketo forms

Go to solution
RaulEr
Level 4

Send email over URL using Marketo forms

Hi,

 

I tried to use Marketo tokens in the follow-up URL but it seems it only allows my.tokens. And since we can't use tokens inside tokens.

 

Is there a way I can send the email of a person in the follow-up URL, like https://www.google.com/?email=aaa@bbb.com

 

Thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Send email over URL using Marketo forms

Just use the email script token for this. Make sure you output the fully formed hyperlink (<a> through </a>) from the email script token instead of outputting the URL (https://www.google.com/?email=aaa@bbb.com) alone.

 

<a href="https://www.google.com?email=${esc.url($lead.Email)}">ABC</a>

 

Also, just putting it out here that I'm not a fan of putting PII in the URL. Is there any alternate way you could avoid this?

 

Edit- This solution applies for including Email Address in the URL within an email asset.

View solution in original post

SanfordWhiteman
Level 10 - Community Moderator

Re: Add email to Thank You URL using Marketo forms

I assume you don’t mean “send” (as in sending a separate email) but actually “append to the query string”, correct?

 

This is simple:

MktoForms2.whenReady(function(readyForm){
  readyForm.onSuccess(function(submittedValues, originalThankYouHref){
    const thankYouURL = new URL(originalThankYouHref);
    thankYouURL.searchParams.set("email", submittedValues.Email);
    document.location.href = thankYouURL.href;
    return false;
  });
});

 

I share Darshil’s misgivings about include PII in the URL but if your destination page requires it there’s no avoiding it.

View solution in original post

4 REPLIES 4
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Send email over URL using Marketo forms

Just use the email script token for this. Make sure you output the fully formed hyperlink (<a> through </a>) from the email script token instead of outputting the URL (https://www.google.com/?email=aaa@bbb.com) alone.

 

<a href="https://www.google.com?email=${esc.url($lead.Email)}">ABC</a>

 

Also, just putting it out here that I'm not a fan of putting PII in the URL. Is there any alternate way you could avoid this?

 

Edit- This solution applies for including Email Address in the URL within an email asset.

RaulEr
Level 4

Re: Send email over URL using Marketo forms

Thanks Darshil, that helps a lot and believe me, we didn't want to do this, but we are having issues with Heap to recognize email, so our workaround for now will be doing this.

SanfordWhiteman
Level 10 - Community Moderator

Re: Add email to Thank You URL using Marketo forms

I assume you don’t mean “send” (as in sending a separate email) but actually “append to the query string”, correct?

 

This is simple:

MktoForms2.whenReady(function(readyForm){
  readyForm.onSuccess(function(submittedValues, originalThankYouHref){
    const thankYouURL = new URL(originalThankYouHref);
    thankYouURL.searchParams.set("email", submittedValues.Email);
    document.location.href = thankYouURL.href;
    return false;
  });
});

 

I share Darshil’s misgivings about include PII in the URL but if your destination page requires it there’s no avoiding it.

RaulEr
Level 4

Re: Add email to Thank You URL using Marketo forms

Yeah that "Send" was to append the value to the query string, thanks Sanford!

oh javascript solution! Nice, thanks!