Created
February 11, 2016 00:14
-
-
Save cougrimes/f909ee5c4ff863936b4a to your computer and use it in GitHub Desktop.
Have long forms? See where people give up.
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
var parentForm = document.querySelector("[id^=mktoForm_]"); | |
parentForm.addEventListener("focusout", doSomething, false); | |
var formId = document.querySelectorAll('form.mktoForm')[0].getAttribute('id'); | |
function doSomething(e) { | |
if (e.target !== e.currentTarget) { | |
var clickedItem = e.target.id; | |
ga('create', 'UA-XXXXXXXX-X'); | |
ga('send','event','Marketo Form Fillout', formId, clickedItem) | |
} | |
e.stopPropagation(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment