Page 1 of 1

Google Analytics

PostPosted: Tue Sep 04, 2012 7:38 pm
by kissiesteve
Hey guys, new to the forum. I want to add google analytics to my subsonic page so i can keep track of page hits and ip addresses
I know almost nothing about java but i am ok with html. can someone give me instructions on where i can add the google code?

Re: Google Analytics

PostPosted: Tue Sep 04, 2012 9:03 pm
by MadEvil
hi,

Just edit your \subsonic\jetty\<####>\webapp\script\scripts.js and ad this code

replace the UA-00000000-0 with your account id

that's all, this should work. mine does :wink:

Code: Select all
/// Google

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-00000000-0']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
  })();


best regards

google.PNG

Re: Google Analytics

PostPosted: Wed Sep 05, 2012 4:10 pm
by kissiesteve
Thank you so much, worked like a charm. i pasted that right at the top. Thanks for your time

Re: Google Analytics

PostPosted: Wed Sep 05, 2012 7:25 pm
by MadEvil
kissiesteve wrote:Thank you so much, worked like a charm. i pasted that right at the top. Thanks for your time

no problem :wink: