|
|
JavaScript Code |
1 2 3 4 5 6 7 8 9 |
<script type="text/javascript"> function recordOutboundLink(link, category, action) { try { var pageTracker=_gat._getTracker("UA-XXXXX-X"); pageTracker._trackEvent(category, action); setTimeout('document.location = "' + link.href + '"', 100) }catch(err){} } </script> |
|
|
HTML Code |
1 |
|
Viele Grüße,
Quoted
Force a click on a link to be recorded as an outlink in Piwik
If you want Piwik to consider a given link as an outlink (links to
the current domain or to one of the alias domains), you can add the
'piwik_link' css class to the link:
<a href='http://mysite.com/partner/' class='piwik_link'>Link I want to track as an outlink</a>
Note: you can customize and rename the CSS class used to force a click to being recorded as an outlink:
[...]
// now all clicks on links with the css class "external" will be counted as outlinks
piwikTracker.setLinkClasses( "external" ); // you can also pass an array of strings
piwikTracker.trackPageView();
[...]
Alternatively, you can use Javascript to manually trigger a click on
an outlink (it will work the same for page views or file downloads). In
this example, we trigger a custom Outlink when the email adress is
clicked:
<a href="mailto:namexyz@mydomain.co.uk" target="_blank"
onClick="javascript:piwikTracker.trackLink('/mailto/Agent
namexyz');"> namexyz@mydomain.co.uk </a>
|
|
HTML Code |
1 |
<a href="bannerurl"><img src="bannerimg" /></a> |
|
|
HTML Code |
1 |
<a href="bannerurl" onClick="piwikTracker.trackLink('/banner1');"><img src="bannerimg" /></a> |
|
|
HTML Code |
1 2 3 4 5 6 7 8 9 10 11 12 |
<!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$PIWIK_URL}" : "http://{$PIWIK_URL}"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$IDSITE}); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script> <!-- End Piwik Code --> |
ändern müsste ich es demnach dann so, oder?
Quoted
<br />
<div style="text-align: center;">
<a href="http://www.lang-ms.de" style="border: 0;">
<img src="http://www.blablabla.de/banner/lang.gif " alt="Lang-MS" /></a>
<a href="http://www.arbeitsschutz-center.de/webcom/show_article.php/_c-87/_nr-61/_lkm-308/i.html
" style="border: 0;">
<img src="http://www.blablabla.de/banner/famable.gif " alt="" /></a>
</div>
<br />
wäre das so okay?
Quoted
<br />
<div style="text-align: center;">
<a href="http://www.lang-ms.de" onClick="piwikTracker.trackLink('/banner1');"> style="border: 0;">
<img src="http://www.blablabla.de/banner/lang.gif " alt="Lang-MS" /></a>
<a href="http://www.arbeitsschutz-center.de/webcom/show_article.php/_c-87/_nr-61/_lkm-308/i.html" onClick="piwikTracker.trackLink('/banner2');"> style="border: 0;">
<img src="http://www.blablabla.de/banner/famable.gif " alt="" /></a>
</div>
<br />