Forum Discussion

LisaWhalen-82fd's avatar
LisaWhalen-82fd
Community Member
4 years ago

Google Analytics - Tracking Events

I used to use Google Analytics (GA) in Storyline 360 at my previous job, including tracking button clicks with event tracking.  It used to work beautifully and allowed me to see how my users interacted with the modules and tools I created in Storyline.

I understand that there's code that needs to go in the head section from your GA account with the UA number that you can copy/paste from your admin for GA.  Then there are Execute Javascript triggers within Storyline for buttons, etc, that you want to track.  However, at my new job.  I hadn't been using GA for about a year, so the code updated a bit, but I do have the access and new code for the header section.  I started doing this again, and cannot get the event triggers to work. I worked with a person who specializes in GA coding, and he confirmed my code was correct.  However, there's something going on in the published ouptut from Storyline that is not calling the javascript for some reason.  I click the javascript in view source, and see it there, but it's not firing.  I also tested by adding an alert popup, that should show when I click the test button, and the alert doesn't pop up, hence my code guy said it's not finding the Javascript code.

Header Code:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-4047813-25"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-1234567-12');
</script>

Trigger - Execute Javascript code (with or without the window.alert part):

window.alert('I am alert');

gtag('event', 'clicked', {
'event_category': 'button',
'event_label': 'Present Button',
'value':
});

The UA has a "dummy" number and where I do see the Page Views in Google Analytics, I do not see the events like I used to. Nothing shows for events. 

I know there have been several updates since I last used this method; however, javascript triggers should still work.  Can someone assist?  I desperately need this soon for a project I need to launch in the beginning of Aug 2021.

Thank you for any assisance!

  • ShannanUlm's avatar
    ShannanUlm
    Community Member

    Hi Lisa, 

    I am having the same issue. I can track hits to the main learning in Google Analytics but events information is not being sent. 

    I have confirmed that my code is correct. I think it may be something to do with the updated publishing of how html and html5 files are output in the new version of Storyline. 

    I am very interested in learning how to fix this. 

    Thank you, 

    Shannan

  • I hope someone from support helps answer soon.  I really need this for a big project I'm working on.  It is literally still working on the old modules, just not new ones, so guessing something to do with upgrades to Storyline.  

  • ShannanUlm's avatar
    ShannanUlm
    Community Member

    Hi Lisa, 

    I put in a support case and heard back. Basically the response is the change was deliberate and they can't help. See the response below from my case. 

    "Storyline 360 did have changes to our HTLML5 output which caused some custom JavaScript triggers not to function as expected as before. Unfortunately, modifying the HTML output and custom JavaScript is something Articulate Support team isn't equipped to handle. "

    I asked for more clarity and they implied that this change was due to 'security'. The impression I got was that they do not want any changes to be made to published files. If Storyline does not do it, they don't want you to adjust it. 

    Not good news. I will have to move the project I am working on to a different development tool.

    I wish you the best of luck. 

    Shannan

  • Looks like I will have to switch to something else too.  I was literally able to build this tool in Power Apps, and include the tracking without Google Analytics.  Very easy and gave me the same thing I needed from Storyline.  Guess I'll be making my tools that way now instead.  And, to make matters worse, since the most recent update, I have a file in the published output, in the vocab folder called strict.xsd that is causing an issue where it won't upload to sync my OneDrive, and I cannot even send a zipped folder with this in it via email, blocked everywhere.  Very frustrating.

  • HI Lisa,

    I know this is an old thread now but wondering if you managed to get this sorted as I am currently able to use Google Analytics with our e-Learning, so happy to help if I can from what I've learnt from some of the legends in the forums.

    Best wishes,

    Aaron

  • Hi, Aaron.

    Since this is an older discussion, Lisa might not be subscribed, but you're welcome to contact them directly through their profile by clicking on their name and selecting Contact Me. 

  • I did get the message via my email and was happy to hear that you got it sorted.  I used to use it all the time, then suddenly it wouldn't work any more.  Therefore, I switched to using Power Apps instead for things I need to track, but would LOVE the option to get back to Google Analytics again.

    • LisaWhalen-82fd's avatar
      LisaWhalen-82fd
      Community Member

      Thank you for the post.  It looks like what I used to do that used to work, but I will look through the code to see if maybe something has changed since my previous issues.  Like I said, it used to work, then after some updates, it stopped working for me.