How to Add Unsubscribe Reason to a Pardot Unsubscribe Page

How to Add Unsubscribe Reason to a Pardot Unsubscribe Page

min. reading

In this post, I’ll show you how to create a page that asks for feedback as to why the prospect is unsubscribing. The goal is to use the standard Marketing Cloud Account Engagement (Pardot) unsubscribe page and ask them why they have unsubscribed on the confirmation page. This gives the prospect the option to complete this information, but it’s not required for them to be unsubscribed from emails.

Unsubscribe Reason Page Preview

Here’s what the completed page looks like.

Implementation Steps

Step 1: Create the custom field(s)

First, create a field in Pardot that will be used to capture the unsubscribe reason.

Optionally, you can create an additional field to capture the reason if “other” is selected in the form.

Step 2: Create the unsubscribe reason form

Create a new form and add your new fields.

Step 3: Style the unsubscribe reason form

Add some CSS to the unsubscribe form in the Above Form section.

Since the only way to get to the unsubscribe reason page will be from an email, I highly recommend hiding the email address field from the form by adding this CSS:

#pardot-form .email {
  display:none;
}

Here’s what my full CSS looks like for my form:

<style type="text/css">
/* hide the email field */
#pardot-form .email {
  display:none;
}
/* the text input */
#pardot-form input.text {
  width: 100%;
  border: solid 1px #E0E0E0;
  background-color: #FFF;
  padding: 10px !important;
  font-size: 15px;
  box-sizing:border-box;
}
/* the dropdown field */
#pardot-form select {
  width: 100%;
  border: solid 1px #E0E0E0;
  background-color: #FFF;
  padding: 10px !important;
  font-size: 15px;
  border-radius: 0;
  -moz-border-radius: 0;
  -webkit-border-radius: 0;
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  background-position: right center;
  background-repeat: no-repeat;
  background-size: 1ex;
  background-origin: content-box;
  color: #868686;
  outline:none;
  background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZ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zLjcwNTM1LC0zLjY4MzA0IGMgLTAuNTU4MDQsLTAuNTU4MDQgLTEuNDUwOSwtMC41NTgwNCAtMi4wMDg5MywwIEwgMjIwLDQxOS4zOTM0NiAyMDguMTQ3MzIsNDA3LjU0MDc4IGMgLTAuNTU4MDMsLTAuNTU4MDQgLTEuNDUwODksLTAuNTU4MDQgLTIuMDA4OTMsMCBsIC0zLjcwNTM1LDMuNjgzMDQgYyAtMC41NTgwNCwwLjU1ODAzIC0wLjU1ODA0LDEuNDczMjEgMCwyLjAzMTI1IGwgMTYuNTYyNSwxNi41NDAxNyBjIDAuNTU4MDMsMC41NTgwNCAxLjQ1MDg5LDAuNTU4MDQgMi4wMDg5MiwwIGwgMTYuNTYyNSwtMTYuNTQwMTcgeiIgLz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=");
}
/* the field labels */
#pardot-form label {
  font-size: 14px;
  color: #868686;
  font-weight:normal;
  padding-bottom:5px;
}
/* the submit button container */
body form.form p.submit {
  margin-left:0;
  text-align:center;
}
/* the submit button */
body form.form p.submit input {
  background:#56CFD2;
  color:#FFF;
  border:0;
  padding:10px 35px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.6923em;
  letter-spacing: 2px;
  cursor:pointer;
}
body form.form p.submit input:hover {
background: #4ebfc2;
}
/* the form */
body form.form {
  line-height: 1.6923em;
  font-size:14px;
  color:#868686;
}
</style>

Step 4: Edit or create a layout template

If your unsubscribe page does not have a dedicated layout template, create a new layout template to use for the unsubscribe page. You can find the layout template name on the settings page for your unsubscribe page.

Navigate to your layout template and click on the Form tab. Find the %%form-before-form-content%% tag within the HTML and replace it with the iFramed version of your unsubscribe reason form. Also, add any text you want to include before or after the embedded form.

Here’s the HTML I replaced the %%form-before-form-content%% tag with:

<!-- START the custom unsubscribe content -->
<h3>Please take a moment and let us know why you unsubscribed.</h3>

<p><iframe allowtransparency="true" frameborder="0" height="250" src="https://go.pardot.com/l/xxx/xxxx-xx-xx/6vr8db" style="border: 0" type="text/html" width="100%"></iframe></p>
<div class="resubscribe">
<h3>Unsubscribed by mistake?</h3>
<p>Click the re-subscribe button below to opt back in.</p>
</div>
<!-- END the custom unsubscribe content-->

And here’s what the full HTML looks like in the Form tab of the layout template:

<form accept-charset="UTF-8" method="post" action="%%form-action-url%%" class="form" id="pardot-form">
%%form-opening-general-content%%

%%form-if-thank-you%%
  %%form-javascript-focus%%
  %%form-thank-you-content%%
  %%form-thank-you-code%%
%%form-end-if-thank-you%%

%%form-if-display-form%%

<!-- START the custom unsubscribe content -->
<h3>Please take a moment and let us know why you unsubscribed.</h3>

<p><iframe allowtransparency="true" frameborder="0" height="250" src="https://go.pardot.com/l/xxx/xxxx-xx-xx/6vr8db" style="border: 0" type="text/html" width="100%"></iframe></p>
<div class="resubscribe">
<h3>Unsubscribed by mistake?</h3>
<p>Click the re-subscribe button below to opt back in.</p>
</div>
<!-- END the custom unsubscribe content-->

    %%form-if-error%%
      <p class="errors">Please correct the errors below:</p>
    %%form-end-if-error%%

    %%form-start-loop-fields%%
      <p class="form-field %%form-field-css-classes%% %%form-field-class-type%% %%form-field-class-required%% %%form-field-class-hidden%% %%form-field-class-no-label%% %%form-field-class-error%% %%form-field-dependency-css%%">
        %%form-if-field-label%%
          <label class="field-label" for="%%form-field-id%%">%%form-field-label%%</label>
        %%form-end-if-field-label%%

        %%form-field-input%%
        %%form-if-field-description%%
          <span class="description">%%form-field-description%%</span>
        %%form-end-if-field-description%%
      </p>
      <div id="error_for_%%form-field-id%%" style="display:none"></div>
      %%form-field-if-error%%
        <p class="error no-label">%%form-field-error-message%%</p>
      %%form-field-end-if-error%%
    %%form-end-loop-fields%%

    %%form-spam-trap-field%%

    <!-- forces IE5-8 to correctly submit UTF8 content  -->
    <input name="_utf8" type="hidden" value="&#9731;" />

    <p class="submit">
      <input type="submit" accesskey="s" value="%%form-submit-button-text%%" %%form-submit-disabled%%/>
    </p>
  %%form-after-form-content%%

%%form-end-if-display-form%%

%%form-javascript-link-target-top%%
</form>

Lastly, here’s my HTML for the entire Layout tab of my layout template.

<!DOCTYPE html>
<html>
  <head>
    <base href="http://go.pardot.com" >
    <meta charset="utf-8"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="description" content="%%description%%"/>
    <title>%%title%%</title>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
    <style type="text/css">

        /* the resubscribe button */
        body form.form p.submit {
            margin-left:0;
        }
        body form.form p.submit input {
            background:#56CFD2;
            color:#FFF;
            border:0;
            padding:10px 35px;
            font-style: normal;
            font-weight: 800;
            text-transform: uppercase;
            line-height: 1.6923em;
            letter-spacing: 2px;
            cursor:pointer;
        }
        body form.form p.submit input:hover {
            background: #4ebfc2;
        }
        /* the resubscribe form */
        body form.form {
            line-height: 1.6923em;
            font-size:14px;
            color:#868686;
        }
        /* the page header */
        h3 {
            font-size:20px;
            color:#666;
        }
        /* the iframed unsubscribed reason form */
        iframe {
            width:420px;
        }
        /* the resubscribe container */
        .resubscribe {
            border-top:solid 1px #ececec;
            padding-top:35px;
        }

    </style>
  </head>
  <body class="bg-light">
 
    <div class="container">
      <div class="py-3 text-center">
        <img class="d-block mx-auto mb-4" src="https://via.placeholder.com/225x70.png?text=LOGO" alt="" width="250">
        <div class="unsubscribe-container">
          %%Content%%
        </div>
      </div>
 
      <footer class="my-5 pt-5 text-muted text-center text-small">
        <p class="mb-1">&copy; 2017-2021 Company Name</p>
        <ul class="list-inline">
          <li class="list-inline-item"><a href="#">Privacy</a></li>
          <li class="list-inline-item"><a href="#">Terms</a></li>
          <li class="list-inline-item"><a href="#">Support</a></li>
        </ul>
      </footer>
    </div>
 
  </body>
</html>

Issues with Email Address Populating

There have been some reported issues with the email address not populating in the unsubscribe reason form. This is because the form depends on cookies in order to populate the email address. The prospect might have a browser setting enabled or they are in Incognito Mode. There are two workarounds to solve this:

Workaround #1: Show the email address field if it’s not populated automatically.

The first workaround is to show the email address field if the email field is not populated automatically. To do this, navigate to your unsubscribe reason form, go to the Look and Feel tab and paste this jQuery code in the Below Form section.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
    $(document).ready(function() { 
    if($('.email input').val() == ''){
    	//show the email field if it's not automatically populated
    	$('#pardot-form .email').show();
   }  
});
</script>

Workaround #2: Hide the unsubscribe reason form if the email address is not populated automatically.

The second workaround is to hide the form altogether if the email address is not populated automatically. To do this, navigate to your unsubscribe reason form, go to the Look and Feel tab and paste this jQuery code in the Below Form section. Update the jQuery with your own messages.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script><script>
    $(document).ready(function() { 
    // Add the header to the unsubscribe reason form instead
    $('#pardot-form').before('<h3>Please take a moment and let us know why you unsubscribed.</h3>');
    // check to see if the email field is empty
    if($('.email input').val() == ''){
    // hide the form and the header if the email field is empty
      $('#pardot-form, h3').hide();
    // display an unsubscribe message instead
      $('#pardot-form').before('You have been unsubscribed');
   }  
});
</script>

Lastly, remove the header from your unsubscribe layout template since the header is placed within the form instead.

Testing 

To test the unsubscribe reason page, you must send yourself a REAL email. The page will not show up if you are using one of the email test features.

Questions?

Send me a tweet @jennamolby or leave a comment below.

Subscribe to The Spot

This field is hidden when viewing the form
This field is hidden when viewing the form
This field is hidden when viewing the form
This field is hidden when viewing the form
This field is for validation purposes and should be left unchanged.

Upcoming Salesforce Events

Salesforce Training Courses

Categories

Top 5 Recent Posts

  • Jenna is a Marketing Operations leader with over 10 years of experience working with both enterprise organizations and start-ups. She started her career as a consultant, helping B2B and B2C clients get the most out of Marketo, Pardot, Marketing Cloud and Salesforce. She then moved in-house, working with B2B SaaS companies, helping them build their sales and marketing technology stacks and processes from scratch.

Leave Your Comment

Related Articles

Bot Single Post