Analytics
4.5K members online now
4.5K 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
star_border
Reply

Tag manager event tracking with on-click - problem

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

We are using Tag manager and GA is implemented in TM. We set on-click parameters on some image links but we don't see it in GA.

Should we set event tracking in TM or should we see it in GA anyway (but we have some programming problem)?

1 Expert replyverified_user

Re: Tag manager event tracking with on-click - problem

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭
Hi, Tamás. If you have installed GA through GTM all events should be set in GTM too. If you set them directly in the code of your web-pages like 'ga(send, ...)' it will not work.

Re: Tag manager event tracking with on-click - problem

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Tatiana, Thanks a lot!

Re: Tag manager event tracking with on-click - problem

Top Contributor
# 4
Top Contributor
Hi Tamas,

If you are tracking your site with GA using GTM there are 2 basic ways to do it:
1. Auto event tracking
2. hardcode a custom event on the onclick event

As you already track via hardcode instead of:
onclick="ga('send",'event'..."

use

onclick="dataLayer.push({'event':'trackEvent', 'eventCategory':'myCategory','eventAction':'myEventAction'});"

In GTm create:
Trigger - custom event > trackEvent
Variables - dataLayer variables (2 in this case) one will be eventCategory and the other eventAction.
Tag - GA event type tag where you will use the trigger as stated before and 2 variables for event category and action respectively.

Kind regards,
Zorin
Web analyst @ escapestudio.net