Title: Google Analytics Tracking
Last modified: August 21, 2016

---

# Google Analytics Tracking

 *  [Chris Gagner](https://wordpress.org/support/users/chrisgagner/)
 * (@chrisgagner)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-tracking-1/)
 * I’m trying to add an onclick event to the Vote Up button. This is the code I’m
   trying to add:
 * `onClick="_gaq.push(['_trackEvent', 'Event', 'Event',,, false]);"`
 * I’m trying to add it to this code:
 * `$link_up = '<span class="thumbs-rating-up'. ( (isset($type_of_vote) && ($type_of_vote
   == 1) ) ? ' thumbs-rating-voted' : '' ) .'" onclick="thumbs_rating_vote(' . $
   post_ID . ', 1);"`
 * When I add it, it looks like this:
 * `$link_up = '<span class="thumbs-rating-up'. ( (isset($type_of_vote) && ($type_of_vote
   == 1) ) ? ' thumbs-rating-voted' : '' ) .'" onclick="thumbs_rating_vote(' . $
   post_ID . ', 1); _gaq.push(['_trackEvent', 'Event', 'Event',,, false]);"`
 * But this isn’t right, I get a syntax error when I make this change. I don’t know
   too much about this.. can you help get this working correctly?
 * [http://wordpress.org/plugins/thumbs-rating/](http://wordpress.org/plugins/thumbs-rating/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Ricard Torres](https://wordpress.org/support/users/quicoto/)
 * (@quicoto)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-tracking-1/#post-4227062)
 * Interesting idea to track the clicks!
 * Try this (note the backslash before the simple quotes):
 *     ```
       $link_up = '<span class="thumbs-rating-up'. ( (isset($type_of_vote) && ($type_of_vote == 1) ) ? ' thumbs-rating-voted' : '' ) .'" onclick=\'thumbs_rating_vote(' . $post_ID . ', 1); _gaq.push(["_trackEvent", "Event", "Event",,, false]);\'';
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Google Analytics Tracking’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/thumbs-rating_d1a77d.svg)
 * [Thumbs Rating](https://wordpress.org/plugins/thumbs-rating/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/thumbs-rating/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/thumbs-rating/)
 * [Active Topics](https://wordpress.org/support/plugin/thumbs-rating/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/thumbs-rating/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/thumbs-rating/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Ricard Torres](https://wordpress.org/support/users/quicoto/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/google-analytics-tracking-1/#post-4227062)
 * Status: not a support question