Home > Web Analytics > Event Tracking – Google Analytics (ga.js)

Event Tracking – Google Analytics (ga.js)

Possible Events:

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.
    if you take 2
    nd possible event as we discussed already. < a href=mailto: [email protected] onclick=javascript: method()>seoservicegroupmail</a>.
    Note: xhtml = use onclick html4.0 <= use onClick

  • onSubmit: Whenever you submit form property, onsubmit event method occurs. If you take 4th possible event as per our discussion earlier. <form action=”somemethodcall()” onsubmit=javascript: mehodcall()>……<input type=”submit” name=”submit” value=”submit”></form>
    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

Syntax:

_trackEvent(category, action, opt_label, opt_value)

Note: Caegory and action are mandatory parameters in trackevent method

<a href=mailto: [email protected] onclick=javascript: pageTracker._trackEvent(“mail”, “click”, “Request through mail”)>seoservicegroupmail</a>.

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.

Filed Under Web Analytics
6 comments on “Event Tracking – Google Analytics (ga.js)
  1. tabsfiroz says:

    Hi Pandiya,

    Great explanation of page tracking using trackevent, but i have a few queries

    1. If I am correct, the trckevent method doesnt create false page views as created by the trackpageview method right? I read about it in the Google webmaster forums so just wanted to confirm…

    2. And for tracking form submits, I have a ‘thnkyou’ page displayed after the submit function, so at this point do i use the trckevent method or the trackpageview method? or use both, as i need to view how many page views are present for my ‘thankyou’ page assuming you only reach that page when you submit the form.

  2. Raghavan says:

    @tabsfiroz – You can directly find the pageviews for the “Thankyou” in Analytics from Top Exit pages in the Content section.

  3. pandiya says:

    @tabsfiroz- Actually your confusing trackevent with pageview, If you have a request for a quote button you want to know how many of them click request for quote button but not send the enquiry. You can track the click using event and goals using pageview.

  4. Jack Bond says:

    Hi

    Great explanation of page tracking using track event

    you write great example of Event Handlers usage in website and Event Tracking method ga.js but you explain next blog are more depth

    Thanks for writting

  5. Luxebutik says:

    In the process of implementing Event Tracking, every name you supply for categories, actions, and labels appears in the reporting interface.

  6. Bosphorus Yacht says:

    So for links, other than adding the”onclick=javascript: pageTracker._trackEvent” codes inside the ahref links, is there any other code needed for the site to make it work?

1 Pings/Trackbacks for "Event Tracking – Google Analytics (ga.js)"
  1. PlugIM.com says:

    Event Tracking Using Google Analytics (ga.js)…

    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

    *

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Categories