Manual event firing on gtag.js not happening

Gold Contributor
Gold Contributor

Hi! We upgraded the Google Analytics tag from the Google Universal Analytics tag version 7110.20200324 to the latest gtag.js with this version - 7133.20200911.  It is capturing data well.  Events set to fire via onclick handler extensions are firing good.   However the ones that were added manually - in the custom option of onclick handler extensions are not firing.  The same code that was working fine with the earlier version is not working now.   This code for example-
utag.link({
ga_events : [{
eventCategory : 'Form_Button_Click',
eventAction : 'Authentication_signin',
eventLabel : 'Sign_in'
}]
});

Control is entering the extension as seen by logs placed before this code.  The log statements after this code are not executed.  The event is also not firing which means something is the matter in this set of lines.   While adding the new tag, all the old extensions were scoped to this.  Where exactly is the mistake in the code? Or in other words, how to add custom events in the latest Google Analytics gtag.js tag please? Thank you! 
@mitchellt - tagging you as you had answered some Google Event related questions in the past.  Thank you!

6 REPLIES 6

Manual event firing on gtag.js not happening

Gold Contributor
Gold Contributor

Hi @sujani_koya ,

The Google Universal Analytics tag template is using a special type of array(ga_events) to push the data directly to GA without mapping, but GTAG snippet doesnot support it. Please refer the screenshot.

So in your case you need to remove the ga_events from your utag.link call. 
Modified utag.link:

utag.link({
eventCategory : 'Form_Button_Click',
eventAction : 'Authentication_signin',
eventLabel : 'Sign_in'
})

Also check your data-mapping, whether eventCategory, eventAction, eventLabel is mapped.

ga_events.JPG

Please refer this link for GA Guide: https://community.tealiumiq.com/t5/Client-Side-Tags/SERIES-Google-Analytics-Guide-for-iQ-Tag-Managem...

 

Thanks, 

VJ

Its Not Who I am Underneath, but What I Do That Defines Me

Manual event firing on gtag.js not happening

Gold Contributor
Gold Contributor

Hi VJ,  mapping is done.  See attached.  I tried without the ga_events line in the utag.link.  Events were not firing stillevent_mapping.png

Manual event firing on gtag.js not happening

Gold Contributor
Gold Contributor

Hi @sujani_koya ,

 The mapping looks good to me. 

Just some random check about the mapping.

1) In console type document.cookie='utagdb=true'; and reload the page.

2) In console, run this

utag.link({
ga_eventCategory : 'Form_Button_Click',
ga_eventAction : 'Authentication_signin',
ga_eventLabel : 'Sign_in'
});

3) Check whether trigger:link is  firing also tag in network tab/ debugger. PFSB

utagdb.JPG

4) If yes that the GA tag is firing, then the mapping is working fine. If yes in console and not in extension then, we should have a check with your jQuery.On click handlers and syntax in cusotm code place.

 

Thanks,
VJ

Its Not Who I am Underneath, but What I Do That Defines Me

Manual event firing on gtag.js not happening

Gold Contributor
Gold Contributor

@dragooonhi thank you for this. This is the result.  What to make of this? The Google tag ID is 615 so it is listing as called before tags loaded.  Can you suggest the next step? Thanks a lot!consoletest.png

Manual event firing on gtag.js not happening

Gold Contributor
Gold Contributor

Hi @sujani_koya ,

I assume from your comment and message that you have removed only ga_events from your utag.link call and dint rename the values to match your UDO variables.

My Assumption,

Before Modification:

utag.link({

ga_events: [{
eventCategory : 'Form_Button_Click',
eventAction : 'Authentication_signin',
eventLabel : 'Sign_in'

}];
})

 

After Modification:

utag.link({

eventCategory : 'Form_Button_Click',
eventAction : 'Authentication_signin',
eventLabel : 'Sign_in'

})

 

But what should have been done, 

 

Could you please check, whether you have given the proper UDO variable in the jQuery On Click Handler (extension) utag.link call ?

 

Example:

1) In the screen shot of data-mapping , you have mapped the following UDO variables to the

Google Analytics (gtag) tag: 

   ga_eventAction (UDO Variable)  

   ga_eventCategory (UDO Variable)

   ga_eventLabel (UDO Variable)

so in the jQuery On Click Handler (extension), in your custom code part also the utag.link call should contain those UDO variable.

It should look like below,

utag.link({

ga_eventAction: 'somevalue',

ga_eventCategory: 'someValue1',

ga_eventLabel: 'someValue1'

});

    

Thanks,

VJ

Its Not Who I am Underneath, but What I Do That Defines Me

Manual event firing on gtag.js not happening

Gold Contributor
Gold Contributor
Thank you!
Public