SOLVED

How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress

Go to solution
DeniseGreenberg
Level 4

How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress

I have a client who uses Marketo Forms embedded in Wordpress pages rather than Marketo Landing Pages. They inherited a setup where a new form was created for every webinar, because they relied on the form to control which thank you page the person was sent to upon submitting the form. I have them persuaded to use one webinar form instead. But that means they have to control which thank you page (post submission page) the form filler is sent to upon clicking the submit button. Can someone please point me to documentation that I can pass on that explains how to do this? I know that this is commonplace and not difficult but I'm not a coder so I don't know how to tell them how to do it (and their wordpress person does not know how).

 

Also - does this require using the Forms 2.0 API? 

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress


Also - does this require using the Forms 2.0 API?

Yes, specifically the onSuccess event handler.

 

MktoForms2.whenReady(function(mktoForm){
  mktoForm.onSuccess(function(submittedValues,originalThankYouURL){
    // set the new Thank You URL, then redirect
    let newThankYouURL = "https://www.example.com/new/page/how/ever/you/choose/";
    document.location.href = newThankYouURL;

    // you must return false so Marketo ignores the originalThankYouURL
    return false;
  });
});

View solution in original post

8 REPLIES 8
SanfordWhiteman
Level 10 - Community Moderator

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress


Also - does this require using the Forms 2.0 API?

Yes, specifically the onSuccess event handler.

 

MktoForms2.whenReady(function(mktoForm){
  mktoForm.onSuccess(function(submittedValues,originalThankYouURL){
    // set the new Thank You URL, then redirect
    let newThankYouURL = "https://www.example.com/new/page/how/ever/you/choose/";
    document.location.href = newThankYouURL;

    // you must return false so Marketo ignores the originalThankYouURL
    return false;
  });
});
DeniseGreenberg
Level 4

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress

Thank  you!

luis003
Level 1

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress

Hey Sandford,

 

I saw another post about running JS in a rich text field. Will code for redirect work when implemented this way? I have code that's looking for specific keywords in the url and redirecting based on that, but I'm having trouble implementing it via tag manager. Ideally, we'd build out this out in CMS with an input in the interface for a thank you page, but in the meantime, I was trying to get clever with the JS.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress


I saw another post about running JS in a rich text field. Will code for redirect work when implemented this way?

Sure. Any custom form behaviors will work if added correctly.

luis003
Level 1

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress

I was able to do it!

I have to say, your contributions to the community have helped me out tons over the years. I'm not sure how you stay so responsive, but I appreciate it.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress

The answer is in the bags under my eyes. 🙂

luis003
Level 1

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress

Will this also work with the form set to show known visitors custom html?

SanfordWhiteman
Level 10 - Community Moderator

Re: How to specify post submission/ thank you page for Marketo Form Embedded in Wordpress


Will this also work with the form set to show known visitors custom html?

Sure, if you enable the JS API events KV HTML.