87 Replies
Niescha Farris

Has anyone been able to do tracking in Rise 360? I was able to use the code David showed years ago but I was only able to see when a user opened the course. I tried adding Google Tag Manager and that took away my ability to see when someone opened the course. I am not sure what I am doing wrong, but would love some help with ways to track clicks, time on lessons etc. in Rise. 

Minh-Tu NGUYEN

Hi everyone,

I am digging out this topic.

We are looking to collect basic statistics with the Riso 360 solution exported in html to be hosted on our website with Google Analytics or At Internet : visits, visitor, view page and number of click on a "Download button" or "Start quizz" button.

Can anyone share a tutorial or give me some insight ?

Thanks,

Have a great day,

Minh-Tu

Andre Lung

I did some tinkering and I think I figured it out. Basically I watch for title changes, which will happen when you open a new section in rise.

Any comments on this are highly appreciated. 

<!-- (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

// TODO enter your personal gtag-id here and in the second line
gtag('config', 'G-XXXXXXXXX');

//// how to track page views in rise
// 0) save the old title for later comparison
let oldTitle = document.title;
// 1) select the target node (title changes)
let target = document.querySelector('title');
// 2) create an observer instance; this code will execute when a change is detected
let observer = new MutationObserver(function(mutations) {
if (oldTitle != document.title) {
// console.log("oldTitle: " + oldTitle);
// console.log("title: " + document.title);
// console.log("mutation: " + mutations[0].target.text);

// reset the comparison to the current title
oldTitle = document.title;
// send change event to google analytics
gtag('event', 'page_view', {'page_title': document.title, 'page_location': location.href});
}
});

// 3) configuration of the observer:
let config = { subtree: true, characterData: true, childList: true };

// 4) pass in the target node, as well as the observer options
observer.observe(target, config);
</script>