Linking storyline reporting to Google Analytics 4

Apr 14, 2022

hello,

in the past I have linked my storyline courses to Google Analytics so that I can collect reporting there, but this works with the old Universal Analytics properties. Now that GA is moving to GA4, does anyone know what the steps are to set up tracking using the new interface?

8 Replies
NOAA Office for Coastal Management

Hi Everyone,

We have been somewhat successful on this but still have work to do (and would love to hear experiences of others). Below are the actions we followed to explore how to start documenting what was occurring within our Storyline and Rise products using GA4 rather than Universal.

First, we put the following code within the <head> component of the index file produced when you publish Storyline or Rise products to the web. 

<script type="text/javascript" src="INSERT_YOUR_URL/federated-analytics.js"></script>

From here we started seeing GA4 events happening within the modules but it was not as comprehensive as hoped.

Next, I worked with our website people to develop a Google Tag Manager holder from iFrame related tags. We needed this because we have to put our Storyline and Rise modules within iFrames. Because of this we followed the following instructions for the index file produced when publishing the storyline and rise modules to the web.

This goes as high as possible in the <head> component of the index file...

<!-- Google Tag Manager -->

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':

new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,'script','dataLayer','INSERT_GOOGLE_TAG_MANAGER_CODE_MIGHT_START_WITH_GTM');</script>

<!-- End Google Tag Manager -->

Then the following code gets pasted at the very top, first item, within the <body> component in the index file...

<!-- Google Tag Manager (noscript) -->

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=INSERT_GOOGLE_TAG_MANAGER_CODE_MIGHT_START_WITH_GTM"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

<!-- End Google Tag Manager (noscript) -->

Next steps are for us to explore the javascript for the triggers in Storyline to help identify the tags specifically. I'd like to start testing with the original javascript code below (the highlighted portion).

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

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

m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

})(window,document,'script','https://www.google-analytics.com/analytics.js','data-ga');

data-ga('create', ''GA4AccountNumber'', 'auto');

data-ga('send', 'event', 'ea', 'ec', 'el');

It's the last two lines in the javascript that I believe need to be edited to accommodate GA-4 rather than Universal Analytics.

Fiona Williams

I have been using the same above code for our Universal Analytics for a few years now. I managed to use UA to remove the need for an LMS/LRS (for public facing content).

Now that we have to migrate to GA4, I just assumed that all I needed to do is replace the UA id with a new GA4 id, use Google Tag Manager and then just get on with it.

Unfortunately, when I replace the UA id with the new GA4 id and do everything else as I have before, none of the code added within Storyline slides shows up. It's almost like the Storyline output and the GA4 no longer communicate with each other. GA4 only registers the URL of the output (stored online), but nothing beyond that.

I thought that it might be to do with now having to add in custom events (previously the events specified with UA within a Storyline file were generated automatically), but without a URL for a slide that seems complicated or impossible. And as someone who isn't an Analytics expert this is pretty frustrating!

Has anyone else gotten stuck with this?

Aaron Kapala

Hi Fiona,

I've only managed to show it once it launches, I've not been successful at getting any of the events recorded. I was going to post on here today to see if anyone had been successful as we use it a lot when we sell our modules which are being hosted on external LMS's etc. so the data is very useful.

Hopefully someone has managed to crack it and can share their wisdom :)

LXD Learning Experience Design

Hi everyone, I have managed to implement a solution that works really well. Follow the link from this discussion to track your projects both, dynamically, and from anywhere (including iframe embedding). I have tested it out on several of my projects and it works like a charm. Happy tracking : )