Concept

Occasionally you may want to make the redirect location of a Pardot form dynamic. To do this, you can pass the URL into the form via a hidden field and then call that URL with a bit of javascript in the form’s Thank You Content.

Instructions

  1. Create a custom field to store your redirect URL and set type to Hidden. (Example name: Redirect) Please make sure this field is NOT set to record and display multiple responses, as this will cause an error in the redirect. Note the field’s ID as you will need this for your javascript code and iframe URL.
  2. Edit your form and on Step 2 add your hidden field. Go to the Advanced section and check the option for “Always display even if previously completed” before saving the field.
  3. While editing your form on Step 4 add the following bit of javascript to your form’s Thank You Code. You will need to update the two places where you see field_id towards the bottom of the script with the field ID of the custom field you created in the first step above.
    <script type="text/javascript">// <![CDATA[
    setTimeout(function(){
    function getUrlParameter(parameterName) {
    var queryString = document.URL;
    var parameterName = parameterName + "=";
    if (queryString.length > 0) {
    var begin = queryString.indexOf(parameterName);
    if (begin != -1) {
    begin += parameterName.length;
    var end = queryString.indexOf( "&" , begin);
    if (end == -1) {
    end = queryString.length
    }
    return unescape(queryString.substring(begin, end));
    }
    }
    return null;
    }
    
    var Url = getUrlParameter("field_id");
    if(Url != null) {
    top.location=Url;
    } else {
    top.location="%%field_id%%";
    }},200);
    // ]]></script>
    
  4. In your iframe URL on your site, add ?field_id=redirect_url where field_id is your custom field’s ID and redirect_url is the URL redirect location that you want to send the prospect to upon completion.