Steven Phan
Forum Replies Created
-
Forum: Plugins
In reply to: [Post My CF7 Form] Post email to pageThank you, I’ve tried inputting a code to attribute it into the url when redirecting but I’m having troubles. The page won’t redirect and I’ve inputted it into the functions.php.
`//This function prints the JavaScript to the footer
function add_this_script_footer(){ ?><script type=”text/javascript”>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
if ( ‘16411’ == event.detail.contactFormId ) { // Southland
location = ‘https://url.com/wp-content/uploads/pdf/success-stories/tech.pdf’;
ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
fbq(‘track’, ‘Lead’);
} else if ( ‘17633’ == event.detail.contactFormId ) { // SurexDirect
location = ‘https://reputationshielder.com/wp-content/uploads/pdf/success-stories/SurexDirect.pdf’;
ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
fbq(‘track’, ‘Lead’);
} else if ( ‘17634’ == event.detail.contactFormId ) { // GetAssist
location = ‘https://url.com/wp-content/uploads/pdf/success-stories/GetAssist.pdf’;
ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
fbq(‘track’, ‘Lead’);
} else if ( ‘17655’ == event.detail.contactFormId ) { // Negative Reviews eBook
location = ‘https://url.com/wp-content/uploads/pdf/ebook/Reviews.pdf’;
ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
fbq(‘track’, ‘Lead’);
} else if ( ‘18180’ == event.detail.contactFormId ) {
var inputs = event.detail.inputs;
for ( var i = 0; i < inputs.length; i++ ) {
if ( ’email’ == inputs[i].name ) {
var email = inputs[i].value;
}
}
location = ‘https://url.com/Account/Register?email=’+email+’;
} else { // Sends submissions on all unaccounted for forms to the third thank you page
location = ‘https://www.url.com’;
ga(‘send’, ‘event’, ‘Contact Form’, ‘submit’);
fbq(‘track’, ‘Lead’);
}
}, false );
</script><?php }
add_action(‘wp_footer’, ‘add_this_script_footer’);