Tracking via piwik

Got an idea? Missing something? Post your feature request here.
Posts: 30
Joined: 02 Apr 2013, 14:07
Has thanked: 10 times
Been thanked: 12 times

Tracking via piwik

Unread post by ForSSux » 26 Sep 2015, 09:00

Hi There,

Is there a way to track visitors via

I found a old thread on subsonic where Madevil :-) answered a question regarding google analytics .
I think this is a very similar case and I hope one can just change code for google analytics by the code for

Is this true?
Do I have to change the underlying code?
Where do I have to insert the code in madsonic?

Code: Select all

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  (function() {
    var u="//";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 1]);
    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);
<noscript><p><img src="//" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
kind regards

Posts: 30
Joined: 02 Apr 2013, 14:07
Has thanked: 10 times
Been thanked: 12 times

Re: Tracking via piwik

Unread post by ForSSux » 02 Oct 2015, 10:42

The best way to achieve this is to insert the Piwik code into head.jsp...

Unfortunate this will not work for every download of Madsonic.

When downloading Madsonic for Windows most people will choose
one of the 2 that are most upwards on the list.
For piwik and more control the Tomcat version works better.

Windows installer (x64) 213 Download Info this one
Windows installer (x86) 43 Download Info or this one
WAR version - JSP default (Tomcat) 47 Download Info

For Tomcat you need to download from

Install this file but make sure it doesn't start the server yet..

complete wipe the content from the this folders
C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps
C:\Program Files\Apache Software Foundation\Tomcat 8.0\work
C:\Program Files\Apache Software Foundation\Tomcat 8.0\temp

Also clean the c:\madsonic folder ( rename the old one to madsonic-org for example you probably need the db :-) ... port#p4708

Rename the madsonic-tomcat.war to ROOT.war and copy it into C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps
Capitals are important otherwise you need to access via http://localhost:8080/root instead of http://localhost:8080
Start the tomcat server and after a while Madsonic is up and running...

If you used the Windows Installer version you find head.jsp here: C:\madsonic - Copy\jetty\5300\webapp\WEB-INF\jsp\head.jsp
Alter it but nothing will hapen after even a reboot ....the actual file is in C:\madsonic - Copy\jetty\5300\webapp\WEB-INF\classes\jsp\WEB_002dINF\jsp\head_jsp.class
This last file isn't easy to edit.....

In the Tomcat version there is data in the c:\madsonic folder but most is here C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\ROOT\WEB-INF\jsp

If you alter here the head.jsp file and restart the tomcat server piwik will can easily test it if you have Ghostery installed

Guy Forssman

I would like to thank Madevil for walking me through this process...
These users thanked the author ForSSux for the post:

Post Reply