The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Hello Everyone,
I am trying to calculate the amount of time a student has logged into a give course. So far I have been able to do this if it is the student's first course but cannot distinguish between course once they get into more than one course.
Am guidance would be much appreciated.
Thank you,
Ryan,
I think one way to do this is to determine the period in which you are counting the number of times a user has logged in to a course. That might be more difficult than it sounds. But it seems like Canvas Data does not really count logins to courses in the way that it counts page requests in the Requests table. Once you are authenticated in Canvas, the database records your activity across the site. And pseudonym_dim is only going to give us the most recent login to Canvas (current_login_at).
If you define a specific period to look for page requests by course, you could use the Requests table to, say, examine the number of unique course_id values that appear for each student for each day in a semester. This may not be as granular as the information you are looking for. If you need something more specific, then there needs to be a guiding rationale for how you decide what counts for a "login" to a course if a student is accessing multiple courses in one sitting.
Sam
On the REQUEST table try to aggregate using course_id and session_id for the user?
That's right--and if the table is sorted by course_id>user_id>timestamp>session_id then you just need to use the timestamps in the first and last row of each unique session_id (per student per course) to impute a "time" spent logged in for each day in each course. But perhaps it's more accurate to say that that would give you the period in which a student did some kind of activity in the course.
This assumes that session_id is unique per course, but I wonder if session_id only applies to your entire Canvas session (thus you could have one session_id value even if you visited multiple course pages). Does anyone know the answer to that offhand?
Sam
I was curious about my question so I went digging...
Session_id is unique for each timestamp_day value in requests--it's the session for someone's daily activity across Canvas. Thus, you could have multiple course_id values for one value of session_id.
Hello Everybody,
Thank you for the tips. I think sorting by user-id, then timestamp oldest-newest and lastly removing dups on session ID works. you can pivot the data for count of session to get logins per day.
I think......
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.