Module tracking with Google Analytics


I've been using a snippet of GA code in my storyline files that registers each slide as a 'pageview'. 

We are moving away from our LMS/LRS (it is getting harder and harder to ensure content and LMS/LRS play nice with each other) and have decided to use GA solely as our source of tracking module activity.

I'm wondering if there is a way to add more information to the GA code that would allow a more precise/better organised way of gathering this information beyond a pageview, as we have A LOT of learning content?

This is the code that goes onto each slide as an execute JavaScript trigger at the start of the timeline (I got this from someone in one of these discussions a few years ago!):


(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),



ga('create', 'GA USER ID HERE', 'auto');

ga('send', 'pageview', 'PAGE TITLE');



7 Replies
Matthew Bibby

My concern with this is that the GA code may not be as reliable as you need. While it's a great solution, Google can change the rules at any time and limit the usefulness of tools like this.

What are the issues with your LMS and LRS? These should be able to communicate with your courses. I've also got some other ideas on how to handle this, reach out if you'd like to discuss.


Dave Ruckley

I've used this guide to add event tracking to a Storyline file which is published as a web app:

The only thing I've noticed is if you set Storyline to always resume the tracking won't work, it has to be never resume or ask to resume.


Dave Ruckley

Hi Bradley,

I've just re-published my Storyline file with the GA stuff added as a SCORM package and uploaded it to Canvas, the LMS I use. The GA tracking worked perfectly as did the SCORM tracking.

The link I posed above has all the instructions I followed to add the GA stuff. There's some Javascript you have to add in Storyline and a small snippet of code you need to add to the story.html and index.lms.html file once you've published.

To check it's working just have analytics open to the realtime data and you'll see your tracked events etc. there.

Bradley Fredrick

Dave, thank you so much. Honestly, I've been an ID for nearly 20 years but unfortunately, I've never mastered (at all) JS. I can however follow directions and am probably one of the most detail oriented people you've ever met. That being said, I've never felt like such an idiot that I can't get this to work. It's just not firing in GA. I see the connected session, but it's like either the LMS is masking the JS Execute Commands or I'm doing something severely wrong. I know you're probably busy, but would it be possible for me to send my little test file to you for examination? I'm obviously missing something. If I can get just the simple page titles to show up, that'd be a start then I can go from there. I have so many questions (due to my detail oriented fashion) and honestly, I've been working on this for over a week with little to nothing to show for it. I think at this point I'm probably a little dumber for having tried all this time :-)

Fiona Williams

Hi Matt,

We are finding that the compatibility with our LRS, our learning content and our websites is becoming more temperamental. Sometimes a software update will mean we can't update content on a site; sometimes our LRS (Grassblade xAPI) stops working; the URLs stop loading; the short-code links it generates don't work; we have to use extremely long and messy URLS to load some sites; one of them refuses to allow us to log into the LRS dashboard, and one hasn't generated any data for several months. Overall I would describe our LRS as clunky at best.

We don't use our LMS for the most part (we have no "courses" that need pass/fail tracking or scoring). We use the LRS primarily to track module launches and completions (TinCan xAPI) through the "attempted" and "completed" statements, and use it to look at page views alongside GA. We also use it to differentiate between different users (which modules are most popular with which users, etc.). 

Some of our sites are also generating so much data that the LRS simply can't handle it. Last week I generated a report for one client that ran from 1 Jan 2020 to now...there was over 60,000 pieces of information and I had to generate reports in 3 month chucks because otherwise the whole thing would fall apart. We do want to be able to limit the use of plugins, as they are becoming increasingly less likely to play nice with each other.

We have had success with the above GA code for several years, for clients who just want to track page views through the user of hyperlinks. We've never had an instance of it not working. The idea is to create custom events to track launches and completions within Google Analytics using menu variables within storyline. However, the only thing we are a little stuck on is how to differentiate between different logged in users. I know that GA does not do this.