Last active
September 21, 2020 15:14
-
-
Save mahbubme/920506498ed964cce6a6a1778141ccda to your computer and use it in GitHub Desktop.
Track MonsterInsights forms
This file contains 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
const submitButtons = document.querySelectorAll("input[type='submit']"); | |
submitButtons.forEach( formButton => { | |
formButton.addEventListener( | |
"click", | |
function (evt) { | |
__gaTracker( | |
"send", | |
"event", | |
"form", | |
"conversion", | |
formButton.form.id, | |
1 | |
); | |
}, | |
false | |
); | |
}); |
This file contains 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
jQuery( function ( $ ) { | |
$( '.play-button' ).click( function () { | |
console.log('Form viewed'); | |
__gaTracker( 'send', { | |
hitType: 'event', | |
eventCategory: 'form', | |
eventAction: 'impression', | |
eventLabel: 'wpforms-form-493', | |
eventValue: 1, | |
nonInteraction: 1 | |
} ); | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment