cancel
Showing results for 
Search instead for 
Did you mean: 
bhuggins
Surveyor II

User PageView API Data Hole

Jump to solution

I'm attempting to generate reports of our instructor's activity to create a sort of report card for them, and I'm using "/api/v1/users/:user_id/page_views" to pull that information.  I'm running into a strange situation that's causing some major concerns for me.  For one user in particular, I'm unable to pull page views for one day, Sept the 24th.  I'm able to pull his activity for the 23rd and 25th, and I'm able to pull the activity of other faculty from 24th.  Additionally, when viewing the instructor's profile on Canvas itself I can see page views for the 24th, and download the CSV report of his activity.

So far I've been unable to find any reports of something similar happening to others, but I want to reach out to see if anyone has any theories on what could be happening, or even better, has encountered this themselves.

Thanks in advance for any input you can provide.

1 Solution

Accepted Solutions
James
Navigator

 @bhuggins ,

The first thing that came to my mind is that the page views inside Canvas and in the CSV file use the local time, while the page views from the API use UTC.

Here's the page view data

254867_pastedImage_4.png

Here's the CSV

254868_pastedImage_5.png

Here's the API information

254866_pastedImage_3.png

I'm in Central Daylight Time and 5 hours behind UTC. So 9:36 pm CDT on October 2 gets 5 hours added to it in the API call and is stored as 2:36 UTC on October 3.

So, it's possible that you're seeing the information for the 24th localtime, but because all API calls use UTC, you have to adjust the time and it's showing up on a different day.

View solution in original post

5 Replies
James
Navigator

 @bhuggins ,

The first thing that came to my mind is that the page views inside Canvas and in the CSV file use the local time, while the page views from the API use UTC.

Here's the page view data

254867_pastedImage_4.png

Here's the CSV

254868_pastedImage_5.png

Here's the API information

254866_pastedImage_3.png

I'm in Central Daylight Time and 5 hours behind UTC. So 9:36 pm CDT on October 2 gets 5 hours added to it in the API call and is stored as 2:36 UTC on October 3.

So, it's possible that you're seeing the information for the 24th localtime, but because all API calls use UTC, you have to adjust the time and it's showing up on a different day.

View solution in original post

James, you're absolutely right on this one.  This instructor is located on the East coast and was working at 11pm his time, so the API returned them as events on the 25th.  I dug in too deep on this issue and failed to think the issue could be as simple as a time zone difference.  Thank you.

kona
Community Coach
Community Coach

Totally off topic, but other than time, what other pieces of information are you planning on including in your Instructor report? Will this be used by the teachers to help them understand their own activity or by distance learning or Admins to check to see how faculty are doing? I'm a Canvas Admin and I have to admit what you're trying to do caught my attention. 

As a side note, would it be easier or better to use Canvas Data for something like this? 

On this particular report I'm pulling just the interactions a faculty has in regards to responding to discussions, creating announcements, posting grades, and general Canvas use.  However, using a combination of context_type, controller, action, and the url of a page view you can make very granular reports on what a user was doing.  I've used page views in reports in the past, but those were quantity based instead of time based to determine which instructors were more or less active in their courses.  In general we create these reports for the directors of the different programs we manage as a sort of report card for their employees.

You may be correct that Canvas Data would be better for this, but for certain logistical reasons, we do not have it enabled for this college's platform currently.

kona
Community Coach
Community Coach

Thanks for sharing your use case, that's super helpful!