Get Contact Field: An Ontraport + WordPress Shortcode Plugin

If you use Ontraport, you may have a WordPress membership website using Ontraport’s WordPress membership plugin called Pilotpress. When members are logged into your Pilotpress membership website, you have access to various information about them (contained in their Ontraport contact record) that you can retrieve using special shortcodes that Pilotpress enables–e.g., the user’s first name, their email address, and other information about them.

Well, I wanted to be able to retrieve this type of information from a contact record without the user having to be logged in to a membership website. So I wrote a plugin to do just that!

As long as someone is a cookied Ontraport contact, this plugin allows you to retrieve any information from the contact’s record in Ontraport–including any custom fields you may have created–and displaying it on any WordPress page, post, or in a widget.

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. You need at least one Ontraport opt-in form at your website (which creates the Ontraport cookie)
  4. In Ontraport, generate a new API Key for the website where you will be using the plugin (if you haven’t already)
  5. Purchase and download the Get Contact Field plugin (the order form is also at the bottom of this post)
  6. Install and activate* the Get Contact Field plugin
  7. Go to Settings > “Get Contact Field” in the WordPress dashboard at the website where you’ll be using the plugin and put in the API key codes from #4 above and save them.

Some Code Examples

• Show the First Name for the cookied Ontraport contact:
[get_contact_field name=”First Name”]

• Show the Email address for the cookied Ontraport contact:
[get_contact_field name=”Email”]

• To display a custom welcome message to cookied contacts, you can use the Get Contact Field shortcode in combination with our free Show if Cookied shortcode.

For example to show a “Hi there Mike!” (or whatever their name is) message to a cookied contact:

[show_if_is_cookied]Hi there [/show_if_is_cookied] [get_contact_field name=”First Name”][show_if_is_cookied]![/show_if_is_cookied]

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 nothing will appear in the place of the shortcode.
  • The plugin includes error messages if you forget to specify a field name 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.

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 “Get Contact Field”).

The Order Form

Contact is Tagged: An Ontraport + WordPress Shortcode Plugin

If you use Ontraport, you may have a WordPress membership website using Ontraport’s WordPress membership plugin called Pilotpress. When members are logged into your Pilotpress membership website, you have access to various information about them (contained in their Ontraport contact record) that you can retrieve using special shortcodes that Pilotpress enables–e.g., the user’s first name, their email address, and other information about them.

There are also shortcodes that allow you to show or hide content on your WordPress pages based on whether a user (called a “contact” in Ontraport) belongs to a certain membership level or has been added to a particular “tag” (an Ontraport means for describing the contact and categorizing them based on actions they have taken on your pages–like purchasing a certain product, filling out a certain opt-in form, and so on).

Well, being an Ontraport user myself, I wanted to find a way to display different content at our WordPress website based on these tags and without the contact having to be logged into the website…because not all of our customers have memberships and/or logins to our websites.

So what I wanted was a shortcode that copies the behavior of the Ontraport [show_if has_tag=”Tag”] content [/show_if] shortcode (also a shortcode for showing content if they *don’t* have a tag), but does it for cookied Ontraport contacts *without them needing to be logged in*. They just need to have filled out an Ontraport form at the WordPress website where you’re using the shortcode/s.

Well, I went ahead and wrote a WordPress plugin to do just that!

I can think of many possible applications of this functionality.

One application that someone in the Ontraport User Community Facebook group mentioned is having an Ontraport form and a thank you page at the same website and having the thank you page display different content based on the tags in the form filler’s contact record.

Other applications are showing different products to each visitor to your website based on what they’ve already purchased from you in the past. This could consist of hiding stuff they’ve previously bought, or showing other products you have available that are related to their past purchases.

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. You need at least one Ontraport opt-in form at your website (which creates the Ontraport cookie)
  4. In Ontraport, generate a new API Key for the website where you will be using the plugin (if you haven’t already)
  5. Purchase and download the Contact is Tagged plugin (the order form is also at the bottom of this post)
  6. Install and activate* the Contact is Tagged plugin
  7. Go to Settings > “Contact is Tagged” in the WordPress dashboard at the website where you’ll be using the plugin and put in the API key codes from #4 above and save them.

Some Code Examples

Content you want to show to a visitor with the “Has Purchased Product A” tag:

[contact_is_tagged with=”Has Purchased Product A”]My HTML content here[/contact_is_tagged]

Content you want to show to a visitor who doesn’t have the “Has Purchased Product A” tag:

[contact_is_not_tagged with=”Has Purchased Product A”]My HTML content here[/contact_is_not_tagged]

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 content between your “Contact is Tagged” shortcodes will simply not appear (i.e., nothing is shown).
  • The plugin includes error messages if you forget to specify a tag 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.

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 “Contact is Tagged: Show Content if Contact has or doesn’t have a Specified Tag”).

The Order Form

An Ontraport “Show if Cookied” Shortcode

If someone fills out an Ontraport form at your WordPress website at which you’ve installed an Ontraport tracking script, a browser cookie is created on that person’s computer–for the particular browser they used when the filled out the form–that lets your website know this person has come to your website previously and filled out a form.

Apparently, there used to be Ontraport shortcodes you could use to show or hide content based on whether the visitor possessed this “form was previously filled-out” cookie. To use it, you would surround content you wanted only cookied visitors to see with this shortcode:

[show_if is_cookied]Content for Ontraport cookied visitors to see[/show_if is_cookied]

There was also a shortcode for showing content to visitors without the cookie:

[show_if not_cookied]Content for visitors without the Ontraport cookie to see[/show_if not_cookied]

Well, Ontraport stopped supporting these shortcodes because, I believe, they weren’t actually working.

But I found myself with a situation where I really wanted this functionality. So, what to do?

I went ahead and created a WordPress plugin that brings this functionality back!

The only difference in the shortcode I created is that I got rid of the single space in the shortcodes because that seemed potentially problematic, though I don’t know whether it actually mattered.

In any case, I changed the shortcodes to [show_if_is_cookied] and [show_if_not_cookied].

Using this Plugin at your WordPress website

Once you have installed and activated* the “Show if Cookied” plugin, you can start using it on any page or post at your WordPress website. Just surround your HTML content you want to show or hide as follows:

Content you want to show to visitors with the Ontraport cookie:

[show_if_is_cookied]HTML content to show to visitors with the Ontraport cookie[/show_if_is_cookied]

Content you want to show to visitors who do not have the Ontraport cookie:

[show_if_not_cookied]HTML content to show to visitors without Ontraport cookie[/show_if_not_cookied]

Come back and post comments if you’re finding this a useful plugin!

Note: if you test 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.


*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 “Show cookied/not-cookied Ontraport Content”).

Scripts, Code Snippets, & Plugins

As a WordPress and Ontraport website developer, I generate a lot of scripts, code snippets, and plugins to manage WordPress and WordPress + Ontraport websites.

I established this website to make some of my code & techniques available to others developing WordPress and WordPress + Ontraport websites.

Please note that I do not work for Ontraport nor for WordPress.com, and neither of those organizations has authorized or vouches for anything posted at this website.