Last active
October 8, 2018 16:47
-
-
Save gjreasoner/829bc3ea31e19575a68a93139517f7f0 to your computer and use it in GitHub Desktop.
Vanilla js
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
function convert(name) { | |
if (!ga) return; | |
var tracker = ga.getAll()[0]; | |
tracker.send("event", name); | |
} | |
document.addEventListener('wpcf7submit', function (event) { | |
convert(event.detail.contactFormId); | |
}); | |
document.querySelector('a[href^="tel:"]').onclick = function () { | |
convert('clicked-call') | |
}; | |
document.querySelector('a[href^="mailto:"]').onclick = function () { | |
convert('email-link') | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment