Analytics
2.6K members online now
2.6K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Tracking events

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I have few questions regarding event tracking:

1. Do I need to add the tracking code  UA-xxxxxxxx-x to all the webpages or can I just add the tracking code to the main webpage and event code to other pages?

ga('send', 'event', 'eventCategory','eventAction' , 'eventLabel');

So, one of my webpage contains only event code and not the tracking code, will it work?

2. Can we add any "value type" to event category, action and label or do we have some default value types.

 

Thanks!! 

Tracking events

[ Edited ]
Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

Hi Urvi,

 

1. Yes, You need to add your Google Analytics tracking snippet in all pages that you have and want to track. Tracking snippet loads analytics.js and this enables 'ga()' command queue. If you just put your event code, your page will throw a JavaScript error (something like "Uncaught ReferenceError: ga is not defined")

 

2. No, Value Type for Event Category, Action and Label is "String" (text) by default and this cannot be changed. If you need to send a value together with the event you can assign it as event Value. Example: ga('send', 'event', 'eventCategory','eventAction' , 'eventLabel', 5);

 

If you want to read more about google analytics events, please refer to following link(official Google Analytics developer guide): https://developers.google.com/analytics/devguides/collection/analyticsjs/events

 

I hope my answer helps you.

 

Regards,

Güney