I ended up having to use Google Tag Manager for my site, so Google Analytics is now a part of that. It's all set up correctly and working fine. However, I used to be able to track custom events on my site very easily, with the ga() function:
ga('send', 'event', 'Videos', 'play', 'Fall Campaign');
However, now ga() is no longer defined; I get an error in the console, ReferenceError: ga is not defined. I then tried the gtag() method and it also doesn't work (same error message):
gtag('event', 'aaa', {
'event_category' : 'bbb',
'event_label' : 'ccc'
});
How can I track events with Javascript code?
To be clear, I do NOT want to fuss with the Google Tag Manager. It's a million clicks to get anything done in there. ;-) I just want to call the Javascript directly, like I always could before.
