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!
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.
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.
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
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...