Created
January 29, 2018 13:25
-
-
Save n1mh/ed0f647c3d573017e89f32171dde7442 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// how to get multiple redirections using DOM in Contact Form 7 | |
// mandatory from January 2018. on_send_ok is deprecated. | |
// wp/wp-content/mytheme/functions.php | |
add_action( 'wp_footer', 'redireccion_contactform7' ); | |
function redireccion_contactform7() { | |
?> | |
<script type="text/javascript"> | |
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
if( '82' == event.detail.contactFormId ) { | |
window.location.replace('https://example.com/thank-you/'); | |
// ga('send', 'event', 'Contact Form', 'submit' ); | |
} | |
//if( 'XX' == event.detail.contactFormId ) { | |
//window.location.replace('https://otherexample.com/thank-you/'); | |
//} | |
}, false ); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment