Analytics question: Event Tracking

Discussion in 'Website Development & Design' started by GekiDan, May 13, 2011.

  1. GekiDan

    GekiDan
    uix_expand uix_collapse
    Active Member

    Joined:
    Jun 11, 2009
    Messages:
    2,594
    Likes Received:
    218
    Since this section is about coding, I just want to ask about some coding to track events via Google Analytics in tracking clicks on banners advertisements and such. I have put it on my ads 2 days ago and still, no report is showing on Google analytics.

    Here's the code I have on one of my banners:

    HTML:
    <a href="http://goo.gl/lFhIn" target="_blank" rel="nofollow" onmouseover="window.status='BigBadToyStore.com - Toys, Action Figures, Vintage Toys, and Collectibles'; return true;" onmouseout="window.status=''; return true;" title="BigBadToyStore.com - Toys, Action Figures, Vintage Toys, and Collectibles" onclick=”pagetracker._trackevent(‘banner’, ‘click’, ‘bbts’);”" ><img alt="BigBadToyStore.com - Toys, Action Figures, Vintage Toys, and Collectibles" src="http://i53.tinypic.com/2rw55q9.gif" border="0" height="60" width="468" /></a>
    Via "View page Source," the onclick codes are colored red. I have a hunch that the coding is incorrect.
    BTW, I just copied the code via Google Help and just made changes on labels and such.

    Hope you could help.
     
  2. PaulPinnacle

    PaulPinnacle
    uix_expand uix_collapse
    Member

    Joined:
    Aug 24, 2010
    Messages:
    275
    Likes Received:
    59
    From a super quick glance, the first obvious issue is mixing between the new asynchronous code and the old ga.js code.

    So, instead of using <a onclick="pageTracker._trackEvent('category', 'action', 'opt_label', opt_value);">click me</a>

    You should be using <a onclick="_gaq.push(['_trackEvent', 'category', 'action', 'opt_label', opt_value]);">click me</a>

    Try updating to the gaq.push method, as outlined here, and let us know if you're still having problems in a day (drop me a PM if you are, remind me in case I'm tied up), and I'll take a closer look.
     
    • Like Like x 2
  3. GekiDan

    GekiDan
    uix_expand uix_collapse
    Active Member

    Joined:
    Jun 11, 2009
    Messages:
    2,594
    Likes Received:
    218
    Thanks Paul. It worked. :thumbsup:
     
    • Like Like x 1
  4. Casey

    Casey
    uix_expand uix_collapse
    Member

    Joined:
    Feb 6, 2011
    Messages:
    103
    Likes Received:
    4
    Pau, thanks also
     

Share This Page