If you ever need to add more than one Piwik tracker per page, that is not a problem. You can do it and load piwik.js
one time as it helps speed up page loading time. This works because each call to Piwik.getTracker
will return a unique tracker object. It works even if each Piwik tracker is pointing at a different server. Here is an example of this in action:
<script type="text/javascript"> var protoCol = ('https:' == document.location.protocol ? 'https://' : 'http://'); document.write(unescape("%3Cscript src='" + protoCol + "URL_1/piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker1 = Piwik.getTracker(protoCol + URL_1/piwik.php", 1); piwikTracker1.trackPageView(); var piwikTracker2 = Piwik.getTracker(protoCol + URL_2/piwik.php", 4); piwikTracker2.trackPageView(); } catch( err ) {} </script>
This time the first part of the script only creates a protoCol
variable instead of a complete...