Close Popup and Create Cookie When a Form is Submitted

Warning! Code Ahead

Avoid the time and hassle of using code and   switch to Ninja Forms, Gravity Forms or Contact Form 7! Popup Maker comes with this functionality built in if you're using the latest versions Ninja Forms, Gravity Forms or Contact Form 7.

Open and close popups, plus create Cookies on form submit with the click of a button by using Popup Maker and Ninja Forms, Gravity Forms or Contact Form 7 together! Plus, these features work with  all triggers.

See How Easy It Is

Traditional Solution with Code

This solution works for Auto Open/Time Delay, Scroll, and Exit Intent Triggers.

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 starting at line 3 to either your theme's functions.php file, or within the 'My Custom Functions' plugin. The latter will preserve your custom code if your theme updates. 

[Note: Don't pass in the opening '<?php' tag to either your functions.php file or plugin editor. It's presented here only to emphasis that the code is written in the PHP programming language.]

Make sure to change the Popup ID # within the example to your popup ID number. To find popup ID numbers in the WP Admin, visit 'Popup Maker' >> 'All Popups' >> 'CSS Classes' (column).

Still need help? Contact Us Contact Us