Your Community is getting an upgrade!
Read about our partnership with Higher Logic and how we will build the next generation of the Instructure Community.
I have a faculty member who would like to use Google Analytics at the course level.
As I understand it, Google Analytics can only be turned on at the account or sub-account level using the Global JavaScript feature.
To provide course level enablement, we are considering moving the course to its own sub-account and using the Global JavaScript for the Google Analytics js.
I have seen references to other institutions using Google Analytics at the account and/or sub-account level.
I am wondering if anyone has tried the approach I have outlined above?
I am also wondering if there are any FERPA concerns with the data used in Google Analytics; I suspect not.
Interested in any feedback anyone has to share.
Hi Daniel,
We had Google Analytics working at our account and subaccount levels last spring and you can go down to the course levels with user defined variables. However, it stopped working when we turned on the new UI and we haven't had time to figure out what the problem is or if it can be fixed.
When we set ours up we followed some advice give to us by Springfield Public Schools, made some modifications and got it working pretty well. Here's a doc with the steps Springfield sent to us - Canvas + Google Analytics - Google Docs
As far as your FERPA concern, we believed we were ok there. However, please run this by your school's legal counsel just to be safe.
Would love to hear about how it goes, so please let us know!
Hello Chris,
Thank you very much - great information.
I will share with you what is decided regarding FERPA.
Chris,
We have a new staff member who will have this kind of Canvas work as his responsibility--woohoo! Did y'all ever get this working with the new UI. I, of all folks, completely understand not having time!:) If you have a timeline for this, let me know, as this is now on our long list. Thanks, Lisa
Hi Lisa,
We haven't made any progress on getting this working with the new UI still and I don't have a timeline either. We just asked our CSM to turn on Canvas Data so that might fit our needs better, we shall see. If we do get this working again, I'll post an update here in the community.
Thanks Chris. We started with our Canvas data last week, will probably review progress every week. Would love to collaborate more!
Hello Chris,
Thanks for the information on setting up Google Analytics. I recently had a request to do the same on our beta instance of Canvas and used your documentation to get 99% of the way there. I think I figured out why it isn't working for you with the new UI. If you change the try block from:
try {
sTemp = window.location.pathname.match(/\/courses\/(\d+)/);
sCourseName = $("#section-tabs-header").text().trim().replace(/\n.*/, '').replace(/\s+/g, ' ').trim();
if (sTemp[1]) // Only set for Courses
{
ga('set', 'dimension1', sTemp[1]);
ga('set', 'dimension2', sCourseName);
}
} catch (err) { }
to:
try {
sTemp = window.location.pathname.match(/\/courses\/(\d+)/);
if(sTemp[1]){
sCourseName = $("#crumb_course_" + sTemp[1]).text().replace(/\n.*/, '').replace(/\s+/g, ' ').trim();
ga('set', 'dimension1', sTemp[1]);
ga('set', 'dimension2', sCourseName);
}
} catch (err) { }
I think that will fix the problem. It appears that Instructure removed the #section-tabs-header item and replaced it with a #crumb_course_XXX, where the XXX is the course number.
Hope that helps, and thanks again for the instructions on how to set up Google Analytics.
Mike
Thanks MIke!!!
So I discovered that the above code only pulls the course name from the course home page. You don't get the course name value from other pages...
I've adjusted the code to perform an API call to gather the course name and sub-account id for each course pageview...
sTemp = window.location.pathname.match(/\/courses\/(\d+)/);
if (sTemp[1]) {
//Get Course information - Course Name and parent sub-account id
var d1 = $.get('/api/v1/courses/' + sTemp[1], function(_course) {
parent_account = _course.account_id
parent_account = parent_account.toString();
sCourseName = _course.name
});
//Wait until api call is done before sending pageview
$.when(d1).done(function(_account) {
// ...do stuff...
ga('set', 'dimension1', sTemp[1]);
ga('set', 'dimension2', sCourseName);
ga('set', 'dimension4', parent_account);
ga('send', 'pageview');
});
} else {
ga('send', 'pageview');
}
I'm also gathering user's information (user role and canvas_user_id) to be able to view role based data like the below chart...
See the below code to (and add it before your pageview is sent).
//Identify User Role
if ($.inArray('admin', ENV['current_user_roles']) == -1 && $.inArray('teacher', ENV['current_user_roles']) == -1 && $.inArray('student', ENV['current_user_roles']) > -1) {
sUserRole = "student"
} else if ($.inArray('admin', ENV['current_user_roles']) == -1 && $.inArray('teacher', ENV['current_user_roles']) > -1) {
sUserRole = "teacher"
} else if ($.inArray('admin', ENV['current_user_roles']) > -1) {
sUserRole = "admin"
} else {
sUserRole = "other"
}
//change the dimension index id if you need to :)
ga('set', 'dimension3', sUserRole);
//Get Canvas Provisioned ID
var d3 = $.get('/api/v1/users/self', function(_user2) {
user_id = _user2.id
user_id = user_id.toString();
});
//Wait until the api call is done
$.when(d3).done(function(_user2) {
// ...do stuff...
ga('set', 'dimension5', user_id);
});
Let me know if you have any questions...
@DanBurgess and LisaCasto, I wanted to make sure you saw Jeremy Perkins new resource, How to Set Up Google Analytics for Canvas, and his upcoming CanvasLIVE session, CanvasCon USF: Using Google Analytics to Understand Canvas Usage.
Thanks awilliams.
To 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.