I need assistance with setting up an analytics event that triggers on page load. I am currently using window.onload if there is no other JavaScript on the page, or $(document).ready() if jQuery is loaded.
The analytics is loading correctly and working fine with analytics.js (not ga.js). To send events back to analytics, I use the following command:
ga('send', 'event', {'hitType': 'event',
'page': '/checkout/',
'eventCategory': 'Forms',
'eventAction': 'formload',
'eventLabel': 'Loaded checkout form correctly'});
However, upon checking the analytics dashboard, it shows that only 2 visits sent events, while all other event stats are at 0. It seems like nothing is being logged.
If anyone could offer some guidance on this issue, it would be greatly appreciated. Thanks!