Re: 'Mailto:' link tracking on Landing Pages

Samantha_Richar
Level 1

'Mailto:' link tracking on Landing Pages

Hi! I am looking to create a smart list to track clicks from an email to a specific landing page then to the various links on that landing page. I have got it for all the other links that are to other landing pages, but having trouble building one for the link that goes to an email prompt (mailto:address) Is it possible to track this since it's not going to another landing page?

I know I can see links like this being tracked in the email link performance report if it is in an email so wondering why it wouldn't be the same if it was on a landing page instead. Thanks in advance for your help!

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: 'Mailto:' link tracking on Landing Pages

Email clicks and web clicks are tracked via totally different mechanisms, see https://nation.marketo.com/groups/newyork-user-group/blog/2018/01/06/more-links-munchkin-wont-track-... 

Samantha_Richar
Level 1

Re: 'Mailto:' link tracking on Landing Pages

Oh no! So there is no way to retrieve this at all? Any workarounds you can suggest? It seems like creating another landing page with a contact us form that sends the email and then tracking the form fills would be the only way correct? 

SanfordWhiteman
Level 10 - Community Moderator

Re: 'Mailto:' link tracking on Landing Pages

Definitely a form is a better bet.

But you can track the mailto: going forward, it just won't work going backward. It takes a tiny bit of JS:

(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
});
});
});
})();

Note you would do

   [contains] "mailto:someone@example.com"

in your Smart List, as opposed [starts with], because of the way Munchkin parses the URL.

Robert_Nichols1
Level 3

Re: 'Mailto:' link tracking on Landing Pages

thanks for this Sanford Whiteman‌ so to enable this you'd have your total javascript as?? the below: 

<script type="text/javascript">
(function() {
var didInit = false;
function initMunchkin() {
if(didInit === false) {
didInit = true;
Munchkin.init('xxxxxxxxx');
}
}
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '//munchkin.marketo.net/munchkin.js';
s.onreadystatechange = function() {
if (this.readyState == 'complete' || this.readyState == 'loaded') {
initMunchkin();
}
};
s.onload = initMunchkin;
document.getElementsByTagName('head')[0].appendChild(s);
})();
(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
});
});
});
})();
</script>

SanfordWhiteman
Level 10 - Community Moderator

Re: 'Mailto:' link tracking on Landing Pages

Can you please highlight that code using the Syntax Highlighter so it's readable?

From what I can see, you've combined the out-of-the-box Munchkin embed with my code in the same script block. I wouldn't do it that way, for clarity put the native code and customization is different <script>s.