Forum:Stats Counter Implementation

Hello, I'd like to implement a stats counter on my wiki, I saw on Runescape wiki that they implemented it in the sidebar. I can do that copying their code, but I'd like also to implement the counter, which is an html/js script code, in the home page (simply add the code doesn't work) otherwise it will be ignored in the stats. So i need a simple javascript code which add the code to the page, or even better add the code in a certain position (indicated, for example by an element with a certain class like div class="counter"). Alternately a script which will add the code to the header or the footer (like those clocks scripts).


 * You need to get the code from Quantcast and use that. You can move it around with CSS once it works.

I'm using Histats, what is Quantcast? Also, I forgot to mention that it's suggested to put the code in tags, (in the body of the page) so if I add the body tags to the code will cause problems? Or I don't even have to do that?

Hi, I think I understand what you're asking. To put the counter on the homepage, add your HTML and JS code to a new page in the MediaWiki namespace: the name doesn't matter, maybe try MediaWiki:Counter. Then, at the bottom of your homepage, put Counter. I think you could put that anywhere on the page, although I'm not sure how you would put that in a certain position: I assume you could add the CSS to MediaWiki:Counter and it would stylize it. Cook Me Plox 20:22, August 5, 2011 (UTC)

Thank you, the "verbatin" code works for the main page, but the code I copied from Runescape wiki doesn't work, maybe there is some kind of conflict with the counter code. The original code was here and produce something like this (under the number of pages). My code is this one and the counter code is:

document.write(unescape("%3Cscript src=%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script%3E"));  try {Histats.start(1,1597101,4,28,115,60,"00011111"); Histats.track_hits;} catch(err){};  

Did I made a mistake somewhere? (note that even the "code highlight" doesn't recognize the language)
 * Assuming you changed it correctly, because Runescape's code is for sitemeter and you're not using sitemeter, the only thing you need to change is you should use single quotes for  because the double quotes are breaking the whole thing.