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”).

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.