Code to add sitewide counter
79,310pages on
this wiki
this wiki
Forum page
This Forum has been archived
Visit the new ForumsForums: Index → Support Requests → Code to add sitewide counter
Wikia's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 271 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.
After reading http://community.wikia.com/wiki/Forum:Need_help_adding_counter_to_all_pages I decided it was time to go ahead and add that sitewide counter that I've long been thinking of.
The sitemeter website says I need to add
<!-- Site Meter --> <script type="text/javascript" src="http://s21.sitemeter.com/js/counter.js?site=s52ReligionWiki"> </script> <noscript> <a href="http://s21.sitemeter.com/stats.asp?site=s52ReligionWiki" target="_top"> <img src="http://s21.sitemeter.com/meter.asp?site=s52ReligionWiki" alt="Site Meter" border="0"/></a> </noscript> <!-- Copyright (c)2009 Site Meter -->
to every page so I added
@import url("http://s21.sitemeter.com/js/counter.js?site=s52ReligionWiki&action=raw&ctype=text/css");
$(function($) {
$(document.body).append('<div id="counter"><a href="http://s21.sitemeter.com/stats.asp?site=s52ReligionWiki" target="_top"><img src="http://s21.sitemeter.com/meter.asp?site=s52ReligionWiki" alt="Site Meter" border="0"/></a></div>');
});
to the sitewide js page.
It doesnt seem to be working.
Did I do something wrong?
Granpa (talk) 14:25, August 17, 2012 (UTC)
- OK, so I changed it to
importScriptURI("http://s21.sitemeter.com/js/counter.js?site=s52ReligionWiki&action=raw&ctype=text/javascript");
- and at first glance it looks like that might be what it needed
- Granpa (talk) 16:22, August 17, 2012 (UTC)
- I went ahead and created a how to here:http://www.wikihow.com/Add-a-Counter-to-Your-Wikia-Wiki
- I would appreciate it if someone would double check it for me
- I'm pretty sure that ctype=text/javascript is a mistake.
- Granpa (talk) 02:54, August 19, 2012 (UTC)
(Reset indent) importScriptURI(); is deprecated. Try using the jQuery alternative $.getScript("link"); .TK-999 (talk) 09:48, August 19, 2012 (UTC)
- The
&action=raw&ctype=text/javascriptis redundant. You only need to add that for JS files on a MediaWiki site (which sitemeter isn't).
- And the code that adds the image to the page isn't needed either. The image is meant for people who don't have JavaScript enabled, so adding it through JavaScript won't give the correct result. - Tjcool007 (Talk) 10:12, August 19, 2012 (UTC)
- i'm using MediaWiki and should i add it in here = Tiny Village Wiki ?
- basicly since i use mediawiki, do i have to use the
&action=raw&ctype=text/javascript??? WieQuadrat (talk) 15:11, August 19, 2012 (UTC)