We are doing something similar, we've created a special page that takes an article ID and increments the counter for that. We put in a 0 px image that references it, like this:
<img src="/imagecounter.gif?id=29204" height=0 width=0>
And use a rewrite rule in apache:
RewriteRule ^/imagecounter.gif(.*)$ /index.php/Special:Imagecounter$1 [L,PT]
You have to disable the code that increments the count though in Article.php. SpecilImageCounter.php just looks like:
function wfSpecialImagecounter( $par ) { global $wgRequest, $wgSitename, $wgLanguageCode; global $wgDeferredUpdateList; $fname = "wfSpecialImagecounter"; $id = $wgRequest->getVal("id"); $t = Title::newFromID($id); if ($t != null) Article::incViewCount( $t->getArticleID() ); $u = new SiteStatsUpdate( 1, 0, 0 ); array_push( $wgDeferredUpdateList, $u ); header('Content-type: image/gif'); exit; }
On 7/5/06, Ilmari Karonen nospam@vyznev.net wrote:
Александр Сигачёв wrote:
An approximate and inaccurate pageview counter is better than none.
We have something like this in Russian Wikipedia. http://meta.wikimedia.org/wiki/Ruwiki_pgcounter
That's clever. I can think of a couple of minor improvements, but the obvious one, if this was implemented on the English Wikipedia, would be to only insert the link randomly on, say, one page in 100.
Of course, the sample will be biased since the trick only works with Javascript, but for many statistical purposes that is acceptable.
-- Ilmari Karonen _______________________________________________ Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l