Highlighted

Event Tracking in Tealium

Rookie Contributor

I'm used to hand coding the customer onclick events in my web pages.  For example, I would add code to my button like this - onClick="gtag('event', 'Click On PDF', { event_category: 'PDF', event_label: 'Song List PDF'});".  That would send the event information over to Google Analytics with no problem.  How do I get the same results by using Tealium?  I already added the Google Analytics tag, and did the data mappings for the event category, event label and event action, but what are the other steps I do?  I'm missing something small, but do I have to use extensions?  Please tell me step by step what I have to do.  Thanks. 

2 REPLIES 2
Highlighted

Event Tracking in Tealium

Gold Contributor
Gold Contributor
Hello @michaelgray,

I 'd recommend you to create a new JS extension and write a code to capture the expected values via Google Analytics event tracking methodology.

Example: When user clicked on Login button and browser throws error message then it would capture the value of error message text in alert
$("#loginButton").click(function(){
var abc = document.getElementsByClassName('error-msg')[0].innerText;
alert(abc);
});

Please go through below link to get more about Google Analytics Event tracking.

https://community.tealiumiq.com/t5/Tags/Google-Universal-Analytics-Event-Tracking/ta-p/14082

Hope it helps!!! Happy Learning!!
Highlighted

Event Tracking in Tealium

Community Manager
Community Manager

@michaelgray To track clicks with Tealium you can either replace your hard-coded gtag code with Tealium tracking calls or use a Javascript Code extension to add event listeners for the clicks you want to track.

In either case, your goal is to replace the vendor specific tracking calls like this one:

gtag('event', 'Click On PDF', { event_category: 'PDF', event_label: 'Song List PDF'});

With vendor-neutral Tealium tracking calls like this:

utag.link({
'tealium_event' : 'custom_click',
'event_action' : 'Click On PDF',
'event_category' : 'PDF',
'event_label' : 'Song List PDF'
});

From there you will map the Tealium variables to the corresonding vendor variables (it sounds like you're already doing this). This makes it easy to configure any additional vendor tags to make use of the same tracking call. Hope that helps.

More info: Event tracking (with utag.js)

 

Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.