In any interactive environment, the program should be able to respond to actions performed by the user. These action can be mouse click, key press or selection of a menu item. What are the possible events we can track using ga.js as follows
If you have anchor tag for third party site link which you want to track how many clicks from our site.
If you have mailto: on anchor tag and you want to track how many of them click for mail link.
In your home page you might have request for quote image, follow us on twitter image etc.. where you want to track, how many clicks on the image.
If you have a button for email subscription button, newsletter subscription etc… Where you want to track the clicks.
When you want to track while you submit action in the form tag
Event Handlers usage in website:
We found out what are the possible events available in the website now we will see, the possible methods available in the website are
onClick: whenever the mouse click event available we can use onclick method in the website.
Note: xhtml = use onclick html4.0 <= use onClick
Note: xhtml= use onsubmit html4.0<= use onSubmit
Event Tracking method ga.js:
We can track the events what we discussed so far, ga.js provide us the event tracking method called _trackEvent(). _trackEvent() method first create and send event tracking call to google analytics tracking code. For example we consider the first event handlers as per our discussion
_trackEvent(category, action, opt_label, opt_value)
Note: Caegory and action are mandatory parameters in trackevent method
We added pageTracker object which we created for google analytics through ga.js, Using pageTracker we call the method viz _trackEvent(). This method will send the event once the person click on seoservicegroupmail. Inside the method we pass parameters like mail, click and request through mail which are category, action and label respectively. For more customization details on ga.js Contact Us
Disclaimer: The post is completely based on individual thoughts and SEO Services Group bears no responsibilities for the thoughts reflected in the post.