Created
December 7, 2018 18:59
-
-
Save jarrodagims/b7cc256ea2c1d1a1fb65838f0a78ecb3 to your computer and use it in GitHub Desktop.
Redirect to thank you
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
//redirect to thank you page | |
function mycustom_wp_footer() | |
{ | |
echo '<script type="text/javascript">'; | |
echo 'document.addEventListener( \'wpcf7mailsent\', function( event ) {'; | |
echo 'window.dataLayer.push({ | |
"event" : "cf7submission", | |
"formId" : event.detail.contactFormId, | |
"response" : event.detail.inputs | |
});'; | |
echo 'location = "' . SITEURL . '/thank-you/";'; | |
echo '}, false );'; | |
echo '</script>'; | |
} | |
add_action( 'wp_footer', 'mycustom_wp_footer' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment