Close/Open Popup and Create Cookie After Contact Form 7 Submission

Popup Maker Version 1.6+ and Contact Form 7 Version 4.7+

The latest versions of Popup Maker and Contact Form 7 offer serious quality of life improvements for implementing specific popup behavior on Contact Form 7 form submits.

Create a Cookie on Form Submit

Create a cookie just like you normally would, except the use the "Contact Form 7 Success" Cookie Creation Event, as shown in the below video:

Close a Popup on Form Submit

Access the "Close Popup" Action when you build your form inside the Contact Form 7 module, as seen in the below video. If you want your users to see your "Success" message, make sure to set a delay (milliseconds) that is long enough so they can read it.

Open a Popup on Form Submit

Access the "Open Popup" Action when you build your form inside the Contact Form 7 module, as seen in the below video:

Previous Versions of Popup Maker and Contact Form 7

If you're using older versions of each plugin, be prepared to use some code - we highly recommend updating to get access the sweet features above!

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 to your functions.php:

Next, after you've added the code in the functions.php, navigate to the Advanced Settings of CF7, and add the following code, replacing the "7" with your form ID number:

Still need help? Contact Us Contact Us