Set a Different Cookie Time on Form Submission

If you are not already familiar with using custom JavaScript, check out our  getting started guide.

Example

Let's imagine you have a form inside a popup. Whenever the popup is closed, it triggers a Cookie, but what happens if the form is submitted and the popup is never technically closed? The popup will continue to Trigger and spam your users!

To make sure the popup doesn't appear again, we must setup a Cookie that is created on form submit so that the user will never see the popup again.

Setup Your Cookie

First,  setup your Cookie your using the Manual JavaScript Cookie Creation Event in the Popup Editor.

After clicking Add, you will be able to customize every aspect of how your Cookie will behave. For detailed explanations on all of the Cookie Settings and features, check out the  Cookie Settings and Features Doc.

Add and Edit Manual JavaScript

Copy, paste and edit the following code either in your parent or child theme  functions.php file, or use the 'My Custom Functions' plugin.  Replace the popup ID number in the code example with the value used with your popup. The ID is located in the WordPress admin at 'Popup Maker' >> 'All Popups' >> 'CSS Classes' (column). The integer value is appended to the class name 'popmake-'