[pmwiki-users] Tracking number of page views statistics

tamouse mailing lists tamouse.lists at gmail.com
Wed Mar 28 21:53:13 CDT 2012


On Tue, Mar 27, 2012 at 12:14 PM,  <writer at creativevirtuosity.com> wrote:
> Patrick:
>
> I am looking for something closer to what the KNOL unit displays for the
> number of views / reads on articles.  The analytics have to display
> stats externally for each page.  See Attached.
>
> Thank you,
> Susan Flander
> http://www.creativevirtuosity.com
> contact no: 877.206.1230
>
>
> Google: CREATIVE VIRTUOSITY
> http://www.linkedin.com/in/creativevirtuosity
> http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=1483678
>
> Social Media Committee:
> http://www.microsoftalumni.org/About/Volunteers.aspx
>
>
>
>
>> -------- Original Message --------
>> Subject: Re: Tracking number of page views statistics
>> From: "Patrick R. Michaud" <pmichaud at pobox.com>
>> Date: Mon, March 26, 2012 8:42 pm
>> To: writer at creativevirtuosity.com
>> Cc: tamouse mailing lists <tamouse.lists at gmail.com>, PmWiki Users
>> <pmwiki-users at pmichaud.com>
>>
>>
>> On Mon, Mar 26, 2012 at 04:37:54PM -0700, writer at creativevirtuosity.com wrote:
>> > I would like to track the number of times some of the pages in my Wiki
>> > are viewed.  Is there a recipe that will allow me to do this?  I can't
>> > find any specifically targeted to display reader stats in the cookbook.
>>
>> For the pmwiki.org site I use Google Analytics (free) to keep
>> track of page view statistics -- Google Analytics makes it easy
>> to see page visits, organize by groups, where visitors are coming
>> from, etc.  See http://www.pmwiki.org/wiki/Cookbook/GoogleAnalytics .
>>
>> (That recipe may need a little updating if Google has changed
>> their tracking code, but the basic idea is there.)
>>
>> Hope this helps!
>>
>> Pm

I'm not quite sure what the meaning of the first number on the Knol
page referring to -- what are they pageviews of? Just that page? Or
all your authored pages? By anyone? Or..?

I don't know if PmWiki stores the information directly about who
created a page, it does know who the last person to modify it was, but
that could very well be someone other than the original creator, so
original author stats might be difficult to obtain. Each diff records
the author of that change, but if you don't save your diffs very long
the original author will disappear. I'm not sure if there are hooks
for page creation, but if there are, I suppose you could do something
to record the original author somehow. I'm not altogether clear on the
implications of adding a field to the page structure, or how one can
get access to those fields programmatically.

As pageviews are typically logged by the web server (access_log in
Apache's configuration, typically /var/log/apache2/access_log on many
newer linux distros), and analytics run on that log, perhaps you could
write something that would periodically run through the access log and
build your numbers. This isn't something you want to do on the fly
during a user's browsing session, as it can take quite a bit of
processing time.

On the other hand, you might be able to hook in a page counter
whenever a page is browsed (I don't think you'd really want to count
other actions on a page in your pageview stats?) and store something
appropriately there. I would definitely not store it in the page
itself as that would mean writing a page on every page view. Maybe an
sqlite data base on the side? This may not scale very elegantly though
if your site is hugely popular and large. Hooking into an action is
pretty simple in config.php:

   if (action == 'browse') include_once('cookbook/pagecount.php');

would include the pagecount recipe once every time the page is viewed
(as opposed to edited, sourced, attributes changed, etc).
pagecount.php could handle bumping counters for that page.

The results of either (or any) process could be stored in the wiki,
possibly something like Profiles.Author-Pageviews, that could be
(:include:)-ed in author's profile page (Profiles.Author) which seems
like it would emulate what Knol is doing.



More information about the pmwiki-users mailing list