Smart Form Prefill: An Ontraport + WordPress Shortcode Plugin

I wrote a WordPress plugin that renders an Ontraport smart form at my WordPress website using a shortcode that looks like:

[op_smartform id=”1″]

..where id is the ID of the smart form in the Ontraport app. Using a shortcode to specify a form versus a javascript snippet is helpful for us in a couple of ways, one of which is that I don’t have to actually go into a form and then to “publish” to get the code from the Ontraport app, I just have to hover my mouse over the form link in the listing of forms to get the ID.

While I was at it, I added the additional feature that the form will automatically prefill with the user’s contact info if they have an Ontraport cookie at my website as the result of having filled out some other form at my website in the past (or if they’ve logged into Pilotpress). This automatic prefill feature is the default behavior of the shortcode.

If I don’t want the form to prefill and/or want the form to render faster (it takes a little longer for it to prefill, though it’s not too slow even then), I’ve added a “switch” to turn off prefilling:

[op_smartform id=”1″ prefill=”no”]

Using the Plugin at your WordPress website

  1. You need to have an Ontraport account
  2. It’s a good idea to install a Ontraport tracking script at your WordPress website–or alternatively, install the Pilotpress plugin
  3. In Ontraport, generate a new API Key for the website where you will be using the plugin (if you haven’t already)
  4. Purchase and download the Smart Form Prefill plugin (the order form is also at the bottom of this post)
  5. Install and activate* the Smart Form Prefill plugin
  6. Go to Settings > “Smart Form Prefill” in the WordPress dashboard at the website where you’ll be using the plugin and put in the API key codes from #3 above and save them.

Some Code Examples

• Render an Ontraport Smart Form with ID=4 and Prefill with Contact data if contact is cookied:

[op_smartform id=”4″]

• Render an Ontraport Smart Form with ID=4 and *don’t* Prefill with Contact data:

[op_smartform id=”4″ prefill=”no”]

Operational Notes

  • If no browser cookie exists for your website visitor (i.e., they haven’t filled out a form at your website; or they have, but now they’re using a different computer or browser), then the form will be rendered but not prefilled.
  • The plugin includes error messages if you forget to specify a form ID in your shortcode, or you specify one that doesn’t exist in your Ontraport account.
  • If you are creating and destroying browser cookies in the process of testing the shortcodes and they don’t seem to be working, make sure you clear the cache at your WordPress website if you are using one of those WordPress website caching plug-ins.
  • You only pay for the plugin once and will receive all/any future updates to the plugin.
  • Please email me at mgm at WordPressAndOntraport.tech if you have any questions or run into any problems trying to install the plugin.

Customer Case Studies

I’m really interested to hear how people end up using the plugin. Please come back to this post and share your stories (as comments on this post) about how you’re the plugin to do interesting and creative things!


*Installing a downloaded zipped WordPress plugin file:

From the WordPress plugin menu click on Add New:

Instead of searching for a plugin you can directly upload your
plugin zip file by clicking on Upload:

Use the browse button to select the plugin zip file that was downloaded, then click on Install Now. The plugin will be uploaded to your blog and installed. It can then be activated (find it on the Installed Plugins page and click the “activate” link under the plugin called “Smart Form Prefill”).

The Order Form

Leave a Reply

Your email address will not be published. Required fields are marked *