woothemes/woocommerce — pull request #1315 by maxrice (2012-07-29 03:34:27+00:00)
Title: added add to cart google analytics event tracking

Initial implementation of GA event tracking. There was no way to hook into the add to cart links / buttons as-is, so I added the onClick attribute to each type. It's built to allow additional event types to be added easily. I've tested it, but it could use some additional auditing.

two new filters:

woocommerce_onclick_javascript - allows GA integration
(and other plugins / themes) to hook into onClick attribute javascript
for add to cart buttons / links. This filter could be added to other links / buttons to allow tracking of additional events.

woocommerce_ga_event_tracking_parameters - allows change of category,
action, or label parameters included in the _trackEvent js code within
onClick.

Closes #1256