cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Learner II

List View Dashboard usage discovery

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?

Labels (1)
4 Replies
Highlighted
Community Advocate
Community Advocate

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.

Highlighted
Community Advocate
Community Advocate

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.

preferenceusers
/dashboard/dashboard_cards24658
/dashboard/view3657
/dashboard/stream_items172

-- 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;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

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.

Highlighted

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.