Support » Plugin: Random Post Link » Add google analytics even tracking?

  • Resolved couchseats


    Is it possible to add the google code for event tracking
    typically you just add something like this into the <a href="">

    onClick="_gaq.push(['_trackEvent', '', '',,, false]);"

    I tried doing that in random-post-link.php but got a syntax error

    any suggestions?


    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

Viewing 1 replies (of 1 total)
  • Plugin Author Christopher Finke


    You’d have to replace line 14 with something like this:

    printf('<a href="%s" onClick="_gaq.push([\'_trackEvent\', ... ]);">%s</a>', get_random_post_url(), $text);

    (Notice the backslashes before each apostrophe in your code.)

Viewing 1 replies (of 1 total)
  • The topic ‘Add google analytics even tracking?’ is closed to new replies.