Hello community!
How to track mailto links on a website (not in email)?
All I found here on Marketing Nation is this post from 2019 by @SanfordWhiteman where he provides the following piece of code:
(function() {
var arrayify = getSelection.call.bind([].slice);
arrayify(document.links).filter(function(link) {
return link.protocol == "mailto:";
}).map(function(mailToLink) {
mailToLink.addEventListener("click", function(e) {
Munchkin.munchkinFunction("clickLink", {
href: this.href
});
});
});
})();
Questions:
- Is this the recommended best way to add support for tracking mailto links on a website?
Note
- Munchkin does NOT track mailto links out-of-the-box (there are more links that munchkin does not track as default, more info here: https://blog.teknkl.com/more-munchkin-untracked-links-part-1/).
Thanks for the help in advance!
Best,
ernie
Solved! Go to Solution.
There’s no better way than my code above.