2.1K members online now
2.1K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Google analytics event tracking issue

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello, I  am using google analytics for tracking user events like signup. but not able to track event in my google analytics account. Please help me what I am missing here.


(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;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '', 'ga');

ga('create', 'UA-XXXXXX-1', 'auto');
ga('send', 'pageview');


This is my event

ga('send', 'event', { eventCategory: 'tenantsregistration', eventAction: 'submit', eventLabel: 'newuser', eventValue: 1});

Re: Google analytics event tracking issue

[ Edited ]
Participant ✭ ✭ ✭
# 2
Participant ✭ ✭ ✭
Hi Abhishek,
First of all, make sure you've configured event handler properly (you'll probably need to tie events to the specific page elements).
Most common ones are onClick, onSubmit, onChange and onLoad.
Secondly, keep in mind that tracking forms can be tricky because most browsers will stop executing JavaScript on the current page once a new page starts to load.
One solution to this problem is to set the transport field to beacon.
Here's just an example:


function formSubmit(event) {
  ga('send', 'event', {
    eventCategory: 'tenantsregistration',
    eventAction: 'submit',
    eventLabel: 'newuser',
    transport: 'beacon'

Hope this helps. Let us know how it goes.


Google analytics event tracking issue

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks, Taavi it's working now!