Tracking via piwik

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

Tracking via piwik

Unread post by ForSSux »

Hi There,

Is there a way to track visitors via piwik.org?

I found a old thread on subsonic where Madevil :-) answered a question regarding google analytics .
http://forum.subsonic.org/forum/viewtopic.php?t=10117
I think this is a very similar case and I hope one can just change code for google analytics by the code for piwik.org.

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 || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//192.168.240.33/";
    _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);
  })();
</script>
<noscript><p><img src="//192.168.240.33/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
kind regards
Guy
ForSSux
Contributor
Contributor
Posts: 30
Joined: 02 Apr 2013, 14:07
Has thanked: 10 times
Been thanked: 12 times

Re: Tracking via piwik

Unread post by ForSSux »

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 https://tomcat.apache.org/download-80.cgi

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 :-) http://forum.madsonic.org/viewtopic.php ... 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 work...one can easily test it if you have Ghostery installed



Voila
Guy Forssman

I would like to thank Madevil for walking me through this process...
These users thanked the author ForSSux for the post:
Madsonic
Rating: 7.69%
Post Reply