Created
March 5, 2019 21:26
-
-
Save jarrodagims/0518b375b065184aefd66f1b7b95c678 to your computer and use it in GitHub Desktop.
PHP switch
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 'var formTitle;'; | |
echo 'switch(event.detail.contactFormId) {'; | |
echo 'case "14567": formTitle = "Contact Form"; formThank: "thank-you"'; | |
echo 'break;'; | |
echo 'case "14683": formTitle = "Service Requests"; formThank: "thank-you-service"'; | |
echo 'break;'; | |
echo 'default: formTitle = "Contact Form"; formThank: "thank-you"'; | |
echo '}'; | |
echo 'dataLayer.push({"event": formTitle + " " + "Form Submitted", "cf7.formID": event.detail.contactFormId});'; | |
echo 'location = "' . SITEURL . '/' + formThank + '/";'; | |
echo '}, false );'; | |
echo '</script>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment