1
votes

I am adding piwik script into my website. And I have added the trackingcode js file ie

if(domains && tracker_url && site_id ) { 
var _paq = _paq || []; 
_paq.push(["setDomains", [domains]]);
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);   
(function() {
    var u= tracker_url;
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', site_id]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();

}

My question is do we need to include any piwik files other than this? ie whether we need to include the piwik.js file and all? Is there any package that is to be included into web root?

1
No, just the tracking code. The tracking code appends all needed js itself. See the docs. And just open up piwik to validate that stats are coming in.giorgio
That means the "u+'piwik.js'" will be automatically taken, right?Ques

1 Answers

2
votes

No, there is nothing else that needs to be included.

The tracking code loads the piwik.js (asynchronously) which then includes everything needed for the tracking.