SOLVED

How to track mailto links on a website (not in email)?

Go to solution
NestoJosa
Level 3

How to track mailto links on a website (not in email)?

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

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How to track mailto links on a website (not in email)?

There’s no better way than my code above.

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: How to track mailto links on a website (not in email)?

There’s no better way than my code above.