Skip to content

Instantly share code, notes, and snippets.

@vanaf1979
Created January 23, 2021 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanaf1979/8fb5184f71151699af2a75e66a93e1e2 to your computer and use it in GitHub Desktop.
Save vanaf1979/8fb5184f71151699af2a75e66a93e1e2 to your computer and use it in GitHub Desktop.
document.addEventListener( 'wpcf7mailsent', function( event ) {
var form = event.target.querySelector( 'input[name="_wpcf7"]' ).getAttribute("value");
if( parseInt( form ) == 4839 ) {
gtag('event', 'form_submit', {
event_category: 'Forms',
event_action: 'Submit',
event_label: 'Test form'
});
}
}, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment