user6586664
user6586664

Reputation: 1

GA Event Tracking for outbound links not working

I've been trying to capture clicks to Amazon from my site through GA but I don't seem to record anything. The code I use on the a href tag is

onclick="_gaq.push(['_trackEvent', 'Affiliate', 'Amazon', 'url', 'http://www.amazon.com/gp/product/B00C76P7Q2/']);"

Here's an example of a page: http://www.thingforyourdesk.com/shop/desk-accessories/house-of-marley-midnight-wireless-bluetooth-portable-audio-system-speaker/ (the link is "View on Amazon")

I have Universal Analytics installed on the site.

Upvotes: 0

Views: 562

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32760

There are (at least) two problems with your example, you are using the wrong version of the code and the wrong parameters. With Universal Analytics the _gaq.push() has been replaced by the ga send method. Also it seems like you are trying to pass key/value pairs as parameters ("Affiliate","Amazon") which results in an invalid value for the last parameter (its categor,action,label,value, where value - if present, it is optional - must be an integer).

Correct syntax looks like that:

ga('send', 'event', 'evenCategory', 'evenAction', 'eventLabel');

Upvotes: 1

Related Questions