• 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://ww.wp.xz.cn/plugins/thumbs-rating/

Viewing 1 replies (of 1 total)
  • Plugin Author Ricard Torres

    (@quicoto)

    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.