SOLVED

Using a token for a form follow up page

Go to solution
Anonymous
Not applicable

Using a token for a form follow up page

Our CRM is not currently integrated with Marketo and we need to automatically update the CRM when someone unsubscribes.

We had been using the following type of a link that was inserted in the footer of the email:

https://website.com/secure/en/!website.event_lib.dispatcher?p_event_name=emailUnsubscribe&p_email={{...

When the link was simply added to the email footer text it worked fine.

Now, we need to use an unsubscribe form and pass the same URL when the form is submitted.

I tried adding this URL as an external URL Thank You page. Marketo would not allow this URL because of the variable at the end. The error message said that only "my" tokens can be used. I have placed the unsubscribe form inside a program and created a program token "Unsubscribe" and placed the entire above string into the token value. However, i used a plain text token.

Then I inserted this program token into  form's thank you page external URL :

pastedImage_4.png

As a result, the URL was passed correctly, however the variable p_email={{lead.Email Address:default=}} wasn't recognized by CRM. I wonder whether it has to do with the fact that I used a plain text token or some other reasons?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Using a token for a form follow up page

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,tyURL){

    var crmTrackingBase = 'http​s://website.cst.org/secure/en/!website.event_lib.dispatcher?p_event_name=emailUnsubscribe&p_email=';

    document.location.href = crmTrackingBase + vals.Email;

    return false;

  });

});

Also see my answer here: Form Fields in External URL

View solution in original post

11 REPLIES 11
Jim_Thao7
Level 9

Re: Using a token for a form follow up page

I believe it's because you can't use tokens w/in tokens.  The actual token itself will resolve it's content as a value rather than the token inside of that token as a value.  Not sure if that make sense the way I explained it.  Just take into a token will not resolve inside of a custom token. 

So you get: p_email={{lead.Email Address}} vs. p_email=something@something.com

Anonymous
Not applicable

Re: Using a token for a form follow up page

Thanks, Jim! Is there another way to achieve the same objective? It's extremely critical for us to pass the Unsubscribe event into the CRM. It's also critical to use an unsubscribe form rather than a link to ensure proper unsubscribe in Marketo and accurate reporting.

Jim_Thao7
Level 9

Re: Using a token for a form follow up page

Some ideas off the top of my head.

Don't use Marketo for the redirect on submission.  Instead, build a redirect using JS, grab the email from the form and concatenate it into your redirect URL for your TYP.  

On the email, link the UTM params you're looking to use, such as {{lead.email address}} and then script the TYP to retain the UTM params on form submission so the values get passed over to your TYP.

Anonymous
Not applicable

Re: Using a token for a form follow up page

ok, thanks, we'll try that!

Anonymous
Not applicable

Re: Using a token for a form follow up page

I wonder if it would be possible to place some javascript on the  Thank you page (that would be a Marketo landing page) that would execute a Javascript function when the thank you page loads.

That Javascript function would redirect the page to 

https://website.cst.org/secure/en/!website.event_lib.dispatcher?p_event_name=emailUnsubscribe&p_email={{lead.Email Address:default=}}

and pass the email value from  the form or from the email token placed somewhere on the thank  you page.

SanfordWhiteman
Level 10 - Community Moderator

Re: Using a token for a form follow up page

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,tyURL){

    var crmTrackingBase = 'http​s://website.cst.org/secure/en/!website.event_lib.dispatcher?p_event_name=emailUnsubscribe&p_email=';

    document.location.href = crmTrackingBase + vals.Email;

    return false;

  });

});

Also see my answer here: Form Fields in External URL

Anonymous
Not applicable

Re: Using a token for a form follow up page

Thanks, Sanford!

Anonymous
Not applicable

Re: Using a token for a form follow up page

Hi Sanford, we tried using a very similar code and it worked fine. There is only one issue though. We need the email address field to be pre-filled. The pre-fill is enabled on the form inside the marketo form editor, but when the form is generated on the page via the script the email field is empty. Is there a way to fix that?

SanfordWhiteman
Level 10 - Community Moderator

Re: Using a token for a form follow up page

Very similar?

You're talking about whether the form on the CST site is prefilled? The Marketo form wouldn't have anything to do with that. The JS above is relaying the data from the Marketo form to another site... can't make the remote site do anything it doesn't want to do.