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
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.