To track events on a site in Google Analytics, use the
_trackEvent method.
Method signature:
_trackEvent (category, action, opt_label, opt_value)category (required) - the category name for the group of objects that you want to track (for example, "Video").
action (required) - the action that defines the event (for example, "Playback").
opt_label (optional) - description of the event (for example, the name of the video).
opt_value (optional) is an integer that represents the numerical data about the event (for example, rating in the case of voting for a video).
')
Examples of using:
- pageTracker._trackEvent ('Video', 'Playback', 'Back to the Future');
pageTracker._trackEvent ('Video', 'Pause', 'Back to the Future');
pageTracker._trackEvent ('Video', 'Stop', 'Back to the Future');
In this case, we will be able to track how many times the film “Back to the Future” was played and stopped.
- pageTracker._trackEvent ('Video', 'Voting', 'Back to the Future', '10');
In this case, we will be able to track how they voted for the film “Back to the Future”. Also for events with a value of opt_value you can see the average value in analytics.
- pageTracker._trackEvent ('Downloading', 'Price List', '/prices/price_foto.xls');
So you can track file downloads.
- You can also track transitions to other sites, such as the banner:
pageTracker._trackEvent ('Go to site', 'By banner', 'Site name or banner name');
For references, the event can be traced as follows:
onClick = "pageTracker._trackEvent ('Video', 'Playback', 'Back to the Future');"and, for example, for forms on the onSubmit event:
onSubmit = "pageTracker._trackEvent ('Form', 'Feedback', 'Leave a Request');"You can view all collected data on tracked events in Google Analytics on the page “
Content-> Event Tracking ”. Events can be viewed by categories, actions and shortcuts. Also for events with a numerical value (the 4th parameter is specified) you can view the average values.
For more information you can read:
Event Tracking ManualThanks for attention!
If you have any questions - ask, I will be glad to help.