Using Marketo forms

Configuring Marketo forms for use in your templates

Customizing thank you page

The normal Marketo form javascript looks something like this:

<script>
MktoForms2.loadForm("//app-ab00.marketo.com", "488-XXX-XXXX", 1234);
</script>

If you would like to customize the form to route the lead to a custom thank you page, you can modify this javascript. Note: make sure that you maintain the three existing values from your Marketo form.

<script>
MktoForms2.loadForm("//app-ab00.marketo.com", "488-XXX-XXXX", 1234, function(form) {
  form.onSuccess(function(values, followUpUrl) {
    // Take the lead to a different page on successful submit
    location.href = "/your-thank-you-page-url/";
    // Return false to prevent the submission handler continuing with its own processing
    return false;
  });
});
</script>

In the above code, you can customize the /your-thank-you-page-url/ and change that to your thank you page.

Using base_directory

If the form within your template will be used on multiple sites under different base_directory paths, you can use our macro to dynamically generate the correct thank you page URL.

location.href = "${base_directory}your-thank-you-page-url/";

Last updated