Student Tracking

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
bkinney's picture

What is the best way to record the amount of time a student has spent on a page in Drupal? I looked at some timer mods, but have not found anything that really does what I want. Should I be trying to make a view that displays student activity? Is the logging accessible from views? Is there something super easy that I'm not seeing?

Ideally I'd like to be able to insert "time spent" into the existing Track view for each page. I'm guessing that isn't an easy thing to do, but just in case it's possible, I thought I'd mention it.

Thanks in advance,

Becky

Comments

got it

bkinney's picture

Apparently I am the only person interested in this issue. No matter, I am posting my solution anyway. After many misadventures trying to work with existing mods or custom views, in the end I did it the old fashioned way. I let Views write the query for me, though. Here is the code I put into a custom block:

<?php
$res
= db_query("SELECT accesslog.aid AS aid, users_accesslog.name AS users_accesslog_name, users_accesslog.uid AS

users_accesslog_uid, accesslog.title AS accesslog_title, accesslog.path AS accesslog_path, accesslog.timestamp AS

accesslog_timestamp FROM accesslog accesslog  LEFT JOIN users users_accesslog ON accesslog.uid = users_accesslog.uid

LEFT JOIN users_roles users_accesslog__users_roles ON users_accesslog.uid = users_accesslog__users_roles.uid AND

users_accesslog__users_roles.rid = 3 WHERE (users_accesslog__users_roles.rid IS NULL) AND (users_accesslog.uid not

in ('0', '1')) ORDER BY accesslog_timestamp ASC"
);

$pt = drupal_get_title();
//$pt += " | Mass & Heat Transfer"; // use this line for subdomain sites. not sure how to grab it dynamically
$u=0;
while(
$item = db_fetch_object($res)){

   if(
$item->accesslog_title == $pt){
    
$startTime = $item->accesslog_timestamp;
   
$dt = date("m",$startTime) . "/" . date("d",$startTime) . "/" . date("y",$startTime);
    
$u =$item->users_accesslog_uid;
     print
$item->users_accesslog_name . " visited on " . $dt ;
     continue;
   }
   if(
$item->users_accesslog_uid == $u){
   
//$hrs = split(":",$tt)[0];
     //$mins = split(":",$tt)[1];
    
$t = $item->accesslog_timestamp;
    
$visitLength floor(($t-$startTime)/6)/10;
    
$u = 0;

     print
" for " . $visitLength . " minutes<br>";
     continue;

   }
}
?>

This solution has one hole in it, which I was unable to plug. If a user exits the site from a page you are trying to track, the system has no way of recording how long they were there. I struggled mightily to find a way around this limitation, and came up dry. So, when a student leaves the system directly from a tracked page without logging off, the record only shows the date of their visit, and does not report a visit duration.

We ran into similar issues

bonobo's picture

Time tracking in a way that means anything is difficult -- if someone opens a page, then goes and makes themselves a sandwich, from the system perspective their sandwich-making time is time on-task.

I would only recommend using time on site along with other metrics -- frequency of logins, comments, posts, etc -- none of these mechanisms, taken individually, mean much, but taken in aggregate they can help create a more complete picture.

But really, none of these means are as valuable as the quality of content a person shares in the site.


FunnyMonkey
Click. Connect. Learn.
Using Drupal in Education

All true,

bkinney's picture

but faculty still want to know. I've tried to talk them out of it, but they are used to having this information (from WebCT) and they DO find it useful. I totally agree that other metrics are needed, and faculty certainly realize this as well. Logged time is just one of many tools in a broader tool kit. Even if it is not perfectly accurate, it is a piece of the larger puzzle that people insist upon having.

To the best of my knowledge

bonobo's picture

To the best of my knowledge the time tracking component of WebCT is still subject to gaming/inaccuracy as described in this thread.

For example: someone can open a page, and then go make a sandwich, come back and open another tab/another browser app and do whatever they want -- the system records this as time spent on-site.

About the best thing I can say about time tracking is that it's wrong in the same ways for all people, so it has some use as an indicator of trends (ie, time onsite increasing/decreasing overall).

Even the ajax methods laid out here are imprecise, and don't do anything to help gauge involvement --

In the past, we have gone about this as dcolburn suggests below, and used this opportunity for advocacy and education about what can be measured in a site (number of posts, ratio of posts to comments, word count of posts and comments, active groups, ratio of teacher posts to student posts (as cross-referenced against the frequency/length of student posts), etc) -- these metrics don't mention time, but they do provide another facet for understanding interactions within a site that might relate to quality.

My .02 -- no easy answers on this, unfortunately.

Cheers,

Bill


FunnyMonkey
Click. Connect. Learn.
Using Drupal in Education

A few ideas

diodata's picture

Hey Becky,

Here are a few ideas that you may be able to implement...

  • you can use ajax (i.e., in the background) and a simple php script to write a visit duration every 20 to 30 sec or so to the database. It won't be completely accurate but within 20 to 30 sec.

  • you can use the onunload or onbeforeunload javascript event to execute some ajax/php to write visit duration.

  • you can make a call to a generic javascript file that does nothing. The trick here is that the url in the javascript call is created from standard php variables available, such as logged in user, time, page title. So, it would be something like donothingfile.js?user=Joh&pagetitle=Lesson Plans for Earthquakes in Delaware&datetime=2009-09-01-13:03:99, etc... This call can be made every 20 - 30 seconds or on the onunload event. This call would be logged in the web logs (access log in apache). You can them write a scrip to analyze the web log files on a daily ot weekly basis.

  • some web analytical tools may give you an average duration on a page but not per user or for any user role.

  • would any of these help
    http://drupal.org/project/click_heatmap
    http://drupal.org/project/activity
    http://drupal.org/project/activity_log
    http://drupal.org/project/heartbeat

I haven't a solution for

dcolburn's picture

I haven't a solution for keeping track of time, but I would like to suggest that one piece of the puzzle is educating the faculty on what a Drupal Ed site is going to achieve. Successful use of a Drupal solution may need some expansion of their understanding of effective learning via online tools. Two key differences, in my mind, are the depth of community possible with Drupal and the resulting sense of ownership by the students.

Unlike Web-CT, a Drupal ED site doesn't have to be a top-down content and activity driven site. Instead, it is a student driven site. As someone who can compare teaching college students with Web-CT and with Drupal, I can see how some instructors are going to be anxious about some of the differences. However, I can tell you from personal experience that the reaction of students is world's apart. They owned the content of the Drupal site; none of them would make that claim about a Web-CT site.

In the end it's about the quality of the student's content, not the amount of time spent looking at pages written by the instructor.

I wish you good luck with providing some time tracking mechanism, but I also hope you have the opportunity to do some evangelizing with the faculty so the full potential of your Drupal site can be recognized and embraced.

RE: Tracking Users

bramface's picture

Hi, Becky.

Game Face created a "Path Track" module to track the paths users take through websites, and also the average time they spend on sites. This was for marketing purposes, but I SUPPOSE it's also a great way to diagnose how students and faculty are responding to some new web resource they are introduced to (without naming any names).

Check it out: http://drupal.org/project/pathtrack

We're not doing anything more with it, but it does seem to work. It's a little heavy on the database (because of the statistics it tracks) so best not to collect information for a month about a high-trafficked site.

Anyone on this thread want to share development of PathTrack, dive in!

-Bram

Drupal in Education

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week