Course Hit Counter Block

Course Hit Counter Block

by Mark Little -
Number of replies: 10
Hi,

Has anybody developed a report or a block which gives you an up-to-date hit counter on the course and also keeps a history of past hits.

Thanks
Average of ratings: -
In reply to Mark Little

Re: Course Hit Counter Block

by Heather P -
There is a stats thing (can't remember if it is a block or a module as it fits in the admin section) you can add to Moodle 1.5.x not sure it would give you hits as such but it does tell you last access and how many users and how many people have been on in the last minute and so forth.
Alternatively as it is a web based item you could apply a web based stats counter. We have AWStats running on our server to give us a clue of the most popluar page and where people are coming to Moodle from.
I've heard good things about Google Analytics but I'm assuming for that to work we would have to allow guest access to Google and currently we don't.
In reply to Heather P

Re: Course Hit Counter Block

by Mark Little -
Thanks for that.

We don't have Awstats installed on our server. I will try this

Mark
In reply to Heather P

Re: Course Hit Counter Block

by Mark Little -
Hi,

Do u have some good instructions on how to get awstats working on a Windows system with Apache...

I think I got the perl working but i can't seem to get awstats to work...

Thanks
In reply to Mark Little

Re: Course Hit Counter Block

by Heather P -
Hi
Apologies for the delay in responding. If you are still trying to get AWStats working I can email you the notes I used to do it.


Can't post them here because they are a bit long.
Heather
In reply to Heather P

Re: Course Hit Counter Block

by Richard Haywood -
If you want to use google analytics ( http://www.google.com/analytics ) then I don't think you will need to enable google to crawl as guest (not 100% sure on that one but it should work without) but you will need to edit the file lib/weblib.php replaceing the line:

-----------------------------------------------------------------------------------------
$output = ob_get_contents();
-----------------------------------------------------------------------------------------

With the lines:

-----------------------------------------------------------------------------------------
$output = "<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\"></script>
<script type=\"text/javascript\">
_uacct = \"XX-XXXXXXX-X\";
urchinTracker();
</script>";

$output .= ob_get_contents();
-----------------------------------------------------------------------------------------

Where the number XX-XXXXXXX-X is your google analytics ID which will be presented to you when you create the account. This seems to work fine for me.
In reply to Richard Haywood

Re: Course Hit Counter Block

by Jim McGregor -

We just put the google script into footer.html in the theme.

Footer rather than header as I've seen some discussion that it gives better performance there.

In reply to Jim McGregor

Re: Course Hit Counter Block

by Mark Schumann -
I used to put mine in the footer but it doesn't appear to work anymore. I haven't tried the method used by Richard but i'll be trying in the next few days.

edit: I edited the weblib.php and it worked straight away. For those of you placing the code in the footer.html, what version of Moodle are you running? From memory my analytics stopped responding after upgrading to 1.7.
In reply to Richard Haywood

Re: Course Hit Counter Block

by Ken Gibson -

Richard,

Thanks for the information. 

Quick question - MUST we edit the lib/web.php file or will just placing the google analytics code in the footer.html code work? 

Ken   

In reply to Richard Haywood

Re: Course Hit Counter Block

by Heather P -
Have you or anyone else worked out if it works without allowing Google to crawl the site as a guest?
We don't want Google as a guest but the analytics thing produces nicer reports than awstats.
In reply to Heather P

Re: Course Hit Counter Block

by Karen Taylor -

I am using Google Analytics to gather stats for our Moodle site, without allowing guest access.