Skip to content

Instantly share code, notes, and snippets.

@EastSideCode
Created April 7, 2018 15:40
Show Gist options
  • Select an option

  • Save EastSideCode/ba1a188c72df870bb6e5c93d52af5690 to your computer and use it in GitHub Desktop.

Select an option

Save EastSideCode/ba1a188c72df870bb6e5c93d52af5690 to your computer and use it in GitHub Desktop.
Alternate contact form 7 tracking
jQuery(document).ajaxComplete(function() {
if (jQuery('.wpcf7-mail-sent-ok').length) {
if (typeof gtag !== 'undefined') {
gtag('event', 'Submit', {
'event_category': 'Contact Form',
'event_callback': function() {
console.log("contact form tracking sent successfully");
}
});
} // end if variable defined
} // end length
}); // end document ajax complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment