WordPress.org

Ready to get started?Download WordPress

Forums

Random Post Link
[resolved] Add google analytics even tracking? (2 posts)

  1. couchseats
    Member
    Posted 1 year ago #

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

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

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

    any suggestions?

    thanks.

    http://wordpress.org/extend/plugins/random-post-link/

    [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.]

  2. Christopher Finke
    Design Engineer at Automattic
    Plugin Author

    Posted 1 year ago #

    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.)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.