Track Piwk Installation Itself

I want to track the Piwik installation itself but cannot insert the tracking Javascript anywhere - gives error. Image tracking does not logs full data. Can someone suggest in which Piwik script page I can insert the Javascript code. Thanks.

Hi ssgupta,

I think you could modify “piwik/plugins/CoreHome/templates/piwik_tag.tpl” to achieve this. Seems like the piwik tracking code is already inserted into each page.


Is this the right way:

(a) Edit and replace my site URL in place of
(b) Replace the existing code with my site’s tracking code

Thanks for the help.

Hi ssgupta,

I think it should be sufficient to change the file piwik/plugins/CoreHome/templates/piwik_tag.tpl as follows:

  • Add your piwik url to the first line:
{if $piwikUrl == '' || $debugTrackVisitsInsidePiwikUI || 'http://yourDomain/piwik/'}
  • Set the correct site id in line eight:
var piwikTracker = Piwik.getTracker("piwik.php", 2);
  • Comment the setCookieDomain call in line 9 or set your own domain:

Or leave the existing code untouched and add the following below:

{if $piwikUrl == 'http://yourDomain/piwik/'}
<div class="clear"></div>
<!-- Piwik -->
<script src="piwik.js" type="text/javascript"></script>
<script type="text/javascript">
try {
 var piwikTracker = Piwik.getTracker("piwik.php", 2); // Set to your piwik website id
} catch(err) {}
<!-- End Piwik Code -->

To force the system to rebuild the templates you should delete all files starting with %% in piwik/tmp/templates_c/.

Many thanks.

Hi n0v1,

In the code above, {if $piwikUrl == ‘http://yourDomain/piwik/’} is only checking if $piwikUrl is set to ‘http://yourDomain/piwik/’ so where is it actually being set to ‘http://yourDomain/piwik/’.

I have adopted the code provided by n0v1 but it is not tracking my piwik installation. And it does not throw any error as well.

Please help.

See this post for more info on how to setup piwik tracking in piwik app itself": 301 Moved Permanently