Fishnet Media logo

Snippets

How to Gate Multiple Assets Using Only One Pardot Form

background

Capturing a Webpage URL in a Hidden Field of a Pardot Form in 4 Steps

Update: 11/12/2020

Browser updates intended to make the internet more secure through HTTPS had a negative effect on the Javascript code utilized in the solution explained in this blog post. Specifically, the referrer tag was no longer capturing full URLs. A relatively new meta referrer tag (which is what we added below) helps control how this information is passed. Traffic remains encrypted and all the benefits of using HTTPS remain in place, but now you can pass referrer data to all websites, even those that use HTTP. Worth noting that if any sensitive information is passed through UTM parameters (which is unlikely in most cases) then this isn’t the safest option. That said, by default, username and passwords are automatically stripped out. Read more about the meta referrer tag.

Jump to solution updates.



Note: This is an advanced Pardot topic that deals with custom JavaScript. I recommend enlisting the support of a developer if you’re not familiar with using Pardot at this level.

I’m a huge fan of the flexibility Pardot gives users in developing custom marketing automation solutions. There are often multiple paths that can be taken to meet project requirements, which makes my work easier. The trick to developing these solutions, though, is to have a clear set of requirements laid out in front of you before beginning.

Recently, Fishnet developed a new website for a client that put Pardot’s functionality to the test. As part of the website, we implemented Pardot as their marketing automation tool. One of their requirements was that they needed to gate more than 20 different assets; however, they didn’t want to maintain a different form for each asset. Additionally, they wanted to be able to see a log of which assets had been downloaded. With only one form, this situation presented a challenge.

The solution we identified involved creating the following:

  1. Two custom hidden form fields
  2.  One form, with both custom hidden fields
  3. Javacript code to capture the custom hidden field values
  4. An Autoresponder with Dynamic Content

Creating Two Custom Hidden Form Fields

Since there is only one form on more than 20 different pages, we needed a way to identify on which page(s) the form was completed. We accomplished this task by creating two new custom fields with the type of “Hidden” using the names below: (You’ll want to remember both Field IDs for a future step)

  1. “Most Recent Product Form Completed”
  2. “Product Form(s) Completed”

The “Most Recent Product Form Completed” field will use JavaScript to store the URL for the page on which the form is located. Every time the form is completed, the existing value will be overwritten with the new page URL value.

The “Product Form(s) Completed” field will store the URL for the page on which the form is located using JavaScript as well; however, it will also store all other previous page URLs on which the form was completed. When you create this field, it is necessary that you select “Record Multiple Reponses”, which will allow for multiple values to be stored in the field as a list.

Just to clarify, we used two different form fields to meet the client’s project requirements–they wanted a way to see all assets that were downloaded. In this article, I’ll detail how each of these fields are used.

Create a Form with Both Custom Hidden Fields

Now that you’ve created both hidden fields, you can go ahead and build your form to gate the assets. In our case, we created a very simple, three-field form (First Name, Last Name and Email), and then added the two hidden fields I detailed above. The configuration should look similar to this:

How to Gate Multiple Assets Using Only One Pardot Form

Note: When you add both hidden form fields, you need to make sure to select “Always display even if previously completed” in the Advanced section:

Note: When you add both hidden form fields, you need to make sure to select “Always display even if previously completed” in the Advanced section:

Add Javacript Code to Capture the Custom Hidden Field Values

At this point, you have a form with some hidden fields. In order to capture the page URL in both hidden fields, you need to copy and paste the following JavaScript code in the Pardot Layout Template that the form is using:

In the <head> tag:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

 

Below the closing </html> tag:

<script>
jQuery(function($){
       if($("#pardot-form").length>0) {
              $("#pardot-form .Most_Recent_Product_Form_Completed input, #pardot-form .Product_Forms_Completed input").val(document.referrer);
       }
});
</script>

UPDATE: 11/12/2020

Additionally, you will need to add the following code into the page header:

<meta name="referrer" content="unsafe-url>

 

Make sure the field input names match up with the hidden field API names. You can get those by going to Admin > Configure Fields > Prospect Fields and finding the corresponding fields.

With the current configuration, every time the form gets submitted both hidden fields would log the URL for the page on which the form was completed. Additionally, the “Product Form(s) Completed” field would log the URLs for all the pages on which the form was completed. Prospect records will look like this:

How to Gate Multiple Assets Using Only One Pardot Form

Create an Autoresponder Using Dynamic Content

Our final step is to automate based off the values in the hidden fields and deliver the correct asset. We accomplished this task using Dynamic Content in an Autoresponder.

We created a new Dynamic Content block and based it off the custom field I created earlier: “Most Recent Product Form Completed”. My Dynamic Content block looked like this:

How to Gate Multiple Assets Using Only One Pardot Form

You’ll notice a couple things here. First, we crafted a universal message, which could be used for all assets. Second, each variation has a “View the Datasheet” CTA. Each CTA contains a link to a different asset, which corresponds to each page URL variation. You will want to have a variation for each page on which the form will live. It is also important to keep in mind that if any of these page URLs change, the Dynamic Content will not function correctly.

We also created default content with instructions to contact a phone number or email directly. If someone has JavaScript disabled, the hidden value won’t be stored in the custom fields we created and we won’t be able to deliver the correct asset. This way, we give them instructions to reach out and we can help them get what they requested.

We put this Dynamic Content into an Autoresponder email and added it as a completion action to the form created in an earlier step. We ended up with something that looked like this:

How to Gate Multiple Assets Using Only One Pardot Form

It is worth noting that we created a Thank You message for the form, which let the prospect know an email was on the way.

How to Gate Multiple Assets Using Only One Pardot Form

There you have it. One form gating 20+ assets, all built within Pardot.

We took what appeared to be a complicated client request and divided it up into logical steps. We identified a set of requirements and built them into a solution that works. And if it didn’t work, we built in functionality to address potential shortcomings.

Not sure where to start? We can help.