Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Open popup after submitting contact form 7
// Print javascript code in the footer of the site to trigger the popup upon form submission
add_action('wp_footer', 'add_popups_trigger_code',150 );
function add_popups_trigger_code(){
// show code on certain page, comment out to print code on every page
if( ! is_page('520') )
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '531' == event.detail.contactFormId ) { // Change 123 to the ID of the form 529 ); // change 143 to the ID of the popup
SPU.hide( 120 ); // hide another popup
SPU.track( 529, false );//track an impression , if you set to true you track a conversion
}, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment