Concept

Want to display your form’s Thank You Content for a few seconds (to confirm a prospect’s successful form submission), but then have your form redirect automatically? Not a problem!

Adjust the following Javascript sample and paste in your form’s Thank You Code tab.

Instructions

  • Go to Marketing > Forms
  • Either edit an existing form or create a new form
  • During Step 4 (“Completion Actions”) of the Form Wizard, click on the Thank You Code tab
  • Copy and paste the following code in the text area field:
    <script type="text/javascript">// <![CDATA[
      var howLongToWait = 5; //number of seconds to wait
      var urlOfDownloadContent = 'http://www.example.com/whitepaper.pdf';
      function triggerDownload() {
      window.location = urlOfDownloadContent;
      }
      setTimeout('triggerDownload()', howLongToWait * 1000);
    // ]]></script><script type="text/javascript">
     var howLongToWait = 5; //number of seconds to wait
     var urlOfRedirectLocation = 'http://www.example.com/home';
     function startRedirect() {
     window.location = urlOfRedirectLocation;
     }
     setTimeout('startRedirect()', howLongToWait * 1000);
    </script>
  • If editing an existing form, press Finish to save. If creating a new form, press Next to go to the confirmation page and then press Finish to save.

Just update the example url to the full url you wish to redirect to, and update ‘5’ to the number of seconds you wish to delay before the download window appears.

When your Pardot form is in an iframe

When your Pardot form exists in an iframe on your site, the redirect location in the above sample will load within the iframe (not ideal). To have the redirect location happen outside of the iframe, use this code sample instead:

<script type="text/javascript">// <![CDATA[
  var howLongToWait = 5; //number of seconds to wait
  var urlOfDownloadContent = 'http://www.example.com/whitepaper.pdf';
  function triggerDownload() {
  window.location = urlOfDownloadContent;
  }
  setTimeout('triggerDownload()', howLongToWait * 1000);
// ]]></script><script type="text/javascript">
 var howLongToWait = 5; //number of seconds to wait
 var urlOfRedirectLocation = 'http://www.example.com/home';
 function startRedirect() {
 window.top.location.href = urlOfRedirectLocation;
 }
 setTimeout('startRedirect()', howLongToWait * 1000);
</script>

Usage Notes

  • In order to use this JavaScript, you must disable any redirect locations–both at the form level or at the landing page level
  • You may want to consider updating your Thank You Content to display a message notifying prospects that their form submission was successful and include a hyperlink that prospects can click to return to your intended redirect location if JavaScript is not enabled on their browser:

Thank you for completing this form! You will be redirected back to the home page in 5 seconds. If not, click here!