Pardot Knowledge Base

Redirecting to Thank You Pages Based on Form Field Values

Last Updated: May 19, 2016 | Print this Article
 
Whoa there, partner! This is an advanced topic that involves custom script. Troubleshooting custom script is outside of Pardot Support’s scope, so proceed with caution.  

It is possible to redirect a prospect to a different page based on the value they submit in the form for a field. By placing the following code in the "thank you code" for the form, we can redirect based on a field value:
Notes:
  • %%Free_Trial_Demo_{js}%% is the form field variable tag (JavaScript encoded).
  • Free Trial is the form value.
  • document.location is the redirect location.
Usage Notes:
  • We recommend JavaScript-encoding your variable tags using {js}. This will prevent special characters from breaking your variable tag's output, and prevent arbitrary code from executing. 
  • If you are using a Pardot form through an iframe and want to redirect the whole page, change document.location to parent.location.
  • You can add more values if needed.  Just add another snippet:
  • In order for the script to work correctly, you must have "allow for multiple responses" unchecked in the field set-up.
  • You can also show prospects unique content on a landing page based on their criteria before a form is submitted. For more information on this method, please see Dynamic Content.

Need more? Start a conversation with other Pardot users in our Success Community