Forum Discussion
Linking storyline reporting to Google Analytics 4
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.