Can't Make Event Tracking Work (Help)

Discussion in 'Google Analytics' started by Big0ne, Sep 3, 2013.

  1. #1
    I tried to follow 2 tutorials and it looks like I failed.

    It's been more than 40 hours and still nothing in Google Analytics.

    I would like to track outbound links. Here is my code:
    <a onclick="_gaq.push(['_trackEvent', 'Outbound Links', 'Click', 'http://domain.com/']);" target="_blank" href="http://domain.com/">DomainName</a>
    PHP:
    Live website: mypornbookmarks.com

    Can anybody help me with this?

    Thank you!
     
    Big0ne, Sep 3, 2013 IP
  2. V_RocKs

    V_RocKs Well-Known Member

    Messages:
    97
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    118
    #2
    Using your code I was able to make it work here: http://www.rhinosgirls.com/scripts/event_tracking.html

    Are you in the Real-Time reports on Analytics?

    Try creating a page like mine on your site and using this. That way you can see if it works with this being the only script on the page. Then start adding scripts from your main site to see if it breaks as you add and test after each one.
     
    V_RocKs, Sep 4, 2013 IP
  3. khemraj

    khemraj Well-Known Member

    Messages:
    400
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    125
    #3
    Seems like event tracking it not working with old GA code, try it with new universal code to work
     
    khemraj, Sep 4, 2013 IP
  4. V_RocKs

    V_RocKs Well-Known Member

    Messages:
    97
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    118
    #4
    I went and completely copied your code verbatim. Then I switched only the property ID, UA-xxxxxx-xx to my own. It worked flawlessly.
    Are you looking in the Real-Time portion of Analytics (top left) or are you trying to find this in the reports towards the bottom left of the menu? They won't show up in reports for a day or two.
     
    V_RocKs, Sep 4, 2013 IP
  5. naveenjosh

    naveenjosh Active Member

    Messages:
    189
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #5
    I tried with new universal code but its not working. As per my analysis, this code only work with old tracking code but not with new one.
    You can get new analytic tracking code here https://developers.google.com/analytics/devguides/collection/analyticsjs/events

    Naveen
     
    naveenjosh, Sep 24, 2013 IP
  6. emilystephi

    emilystephi Member

    Messages:
    73
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    45
    #6
    Hey BigOne,
    I dont find anything wrong in your code syntax. However, remember one thing, this version of your tracking code only work with old (classic) anlaytics (ga.js). Once you add your code on the outbound link, open the "Real-Time Analytcs" & go to "Events" section. Now you have perform a click on this outbound link and check whether your "events" section marking this on analytics. If yes, it means that GA is tracking your clicks.
    If no, then open any browser debug tool (firebug etc) and check the network section. Check any script(especially ga.js) is executing as soon as you click on this outbound button. If yes, it means that your code is executing fine. By this way you can confirm it...
     
    emilystephi, Sep 26, 2013 IP