I was recently working with a large corporate client that uses Pardot to track the activity of their users. As we started talking about how to integrate their new site with Pardot, they indicated that they wanted to be able to show premium content to subscribers of their newsletter.
We looked at several ways of doing this, including querying the Pardot API to check whether the user was a prospect in their system. However, we determined that doing so would result in an unnecessary delay to the user.
Since the Pardot cookie does not provide identifying information that would allow me to determine whether a user was a prospect or not, I came at the problem from a whole different angle.
Instead of retrieving information from Pardot, I would instead rely on my own information and only send information to Pardot.
What this meant was that I would create a form for signing up to the newsletters using Gravity Forms (consisting merely of an email field, though it could have included name, company and any other information) and then send that information to Pardot. If the user already existed, it wouldn’t duplicate the user (important), and if they didn’t exist, it would create them as a new prospect. In each case, it would make sure that the user got subscribed to the lists specified by me.
Once the form was submitted, I set my own cookie in the browser and that way, I knew definitively that the user had subscribed to the newsletter. I set the expiration way off into the future so that they wouldn’t be bugged again for their email address unless they deleted their cookies.
I could then systematically check for the cookie and modify the site for the end user depending on whether or not they had subscribed to the client’s newsletter, such as hiding premium content, limiting commenting ability etc.
How I did it
Now for how I actually did it.
Like I said, the first step was to create a Gravity Form that would collect just an email address.
The next step was to create a Form Handler in Pardot. Log in to your Pardot Control Panel and go to Marketing > Forms > Form Handlers.
From there, you need to add a descriptive name for the Form Handler, select the Campaign that the form is associated with, set the success and error locations, add your completion actions, and set up fields for all of the information that you will be sending to Pardot.
In my case, I set the success and error locations to the Referring URL, because I wanted the user returned to the same page that they were on when they filled out the form (for example, they could then immediately read the article that they were previously restricted from). For the completion actions, I set the lists that I wanted to add the user to. Lastly, since I was only sending an email address to Pardot, the default field (’email’ = Email) was sufficient for me, though you may need to add more if you’re capturing names etc.
Once you save the Form Handler, you’ll need to retrieve the endpoint URL for the Form Handler. This is where our Gravity Form will send the data.
Now, back to your Gravity Form. Go to Settings > Confirmations and edit the default one. The type of confirmation should be Redirect and the Redirect URL should be the Endpoint URL from your Pardot Form Handler. Then, check the box for “Pass Field Data via Query String” and add all of the fields that you’ll be sending to Pardot along with the parameter names you set up earlier.
Your site is now talking to Pardot and if you test your form, you should see your information appear as a new prospect in Pardot, with the appropriate completion actions taken.
One final piece of the puzzle for me was to set a cookie in the browser once the form was submitted, and to then check for it when I needed to protect content, or a feature.
To set the cookie, I used the following snippet:
And to check for the cookie and restrict content accordingly, I used this code:
So that’s how I used Gravity Forms to create a link between WordPress and Pardot, which helped my client to increase readership and subscriptions to their publications.
If you’d like to discuss something similar for your own project, please get in touch with me.