Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
Since the variable ENV.PREFERENCES.dashboard_view isn't accessible through the API, I don't know if this would be possible. We have 400 students for whom I'd like to report usage trends to our faculty. Is there a process that I could automate to collect this information?
You could write a little JavaScript and write that preference to Custom Data
see Users - Canvas LMS REST API Documentation
On the backend loop through students and get the Custom Data on every user.
The user has the ability to write and delete there as well, and you have to be aware of other scripts writing to that space, like Sorting Dashboard Course Cards
---
A little more hacky, but you could possibly write the preference to some other endpoint to make retrieving the data easier. Maybe a conversation, discussion, append it to a course page with student write permissions... Pages - Canvas LMS REST API Documentation
Assuming you don't want to create a bad experience for the student, having them enrolled in a random course or seeing conversations they didn't create... don't execute the code every time they touch the dashboard etc.
---
Possibly a little less hacky, silent even, might be executing a tiny GET request on the dashboard (once with a cookie or localStorage) with a query string parameter for the preference. Then if you have Canvas Data run a query on the requests table.
$.get('?dashboard_view='+ENV.PREFERENCES.dashboard_view)
I have used parameters like this with automated messages to see if students click the course link from the notification/email instead of coming back to Canvas. I'll check over the next couple days to see if I can find that in the data.
Depends on how much code you want to write and whether you affect the end user experience.
Thanks for the tips. I especially like the first approach. Setting the custom data value based on the user's environment is really intuitive. I don't have Canvas Data yet, so I can see requests or pull most recent preferences.
Yea. Canvas Data is often the easiest approach once you have it, but getting it includes hurtles. The query and results below are pulling from the requests table for just this term, starting 8/13 I believe, so it was pretty quick but a lot of queries in the requests table take a considerable amount of time.
So the ajax call I tried above was invisible in requests, didn't investigate after I found something better...
If you have Canvas Data.
Here's our stats. Defaults are powerful.
preference | users |
---|---|
/dashboard/dashboard_cards | 24658 |
/dashboard/view | 3657 |
/dashboard/stream_items | 172 |
-- mssql, get most recent dashboard preference of each user
SELECT
DISTINCT user_id,
url,
MAX(timestamp) most_recent
FROM
dbo.requests
WHERE
user_id IS NOT NULL
AND url IN ('/dashboard/dashboard_cards', '/dashboard/view','/dashboard/stream_items')
GROUP BY
user_id,
url;
-- all users counted by preference
SELECT url, count(*) total
FROM (
SELECT
DISTINCT user_id,
url,
MAX(timestamp) most_recent
FROM
dbo.requests
WHERE
user_id IS NOT NULL
AND url IN ('/dashboard/dashboard_cards', '/dashboard/view','/dashboard/stream_items')
GROUP BY
user_id,
url
) dash_pref
GROUP BY url
ORDER BY total DESC;
I'm surprised this isn't readable through the API as a user setting.
To participate in the Instructure Community, you need to sign up or log in:
Sign In