Set a Different Cookie Time on Form Submission

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


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

Add the code below to your  functions.php, making sure to change the Popup ID #, found in the All Popups Screen, and the Cookie Name to the name of your Cookie in the Popup Editor: