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!