Skip to content

Loading…

Disable mailto:tracking #2731

Closed
mattab opened this Issue · 2 comments

2 participants

@mattab
Piwik Open Source Analytics member

mailto: links are tracked with Piwik. However as of 1.6 we do not track any URL that does not start with http. Therefore the mailto clicks are not tracked anymore. We should instead disable completely and not fire a request.

Users can manually track the mailto: links by doing:

<a href="mailto:namexyz@mydomain.co.uk" onClick="javascript:piwikTracker.trackLink('http://mailto/mailto/Agent namexyz', 'link');">namexyz@mydomain.co.uk</a>
@mattab
Piwik Open Source Analytics member

(In [5356]) Fixes #2731

@anonymous-piwik-user

To automatically track mailto links, use jQuery and this code

<!--Track mailto-->
<script>
jQuery(document).ready(function($) {
    $('a[href^="mailto"]').click(function(){
    piwikTracker.setCustomVariable(1, "Share By Email",  'Email='+this.href.replace(/^mailto:/i,'') + ' /Page = ' +  location.href, "page");  piwikTracker.trackPageView();
    });
});
</script>
<!--End Track mailto-->

more details: http://www.statstory.com/tracking-mail-to-clicks-with-piwik-analytics/

@mattab mattab added this to the 1.7 Piwik 1.7 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.