• Hey everyone,

    I’ve started using onclick push data to Google Analytics to get a better idea of how visitors are navigating through my site. It’s going great except I’ve hit a snag tracking clicks on next and previous post links, as I can’t figure out how to insert the onclick code into the actual next and previous post links. Does anyone know how to do this?

    For example, I need to insert:

    onclick="_gaq.push(['_trackEvent', 'Next Page']);"

    Into a href=”next post”, so that it looks like

    a href="next post"onclick=”_gaq.push([‘_trackEvent’, ‘Next Page’]);”`

    Thanks!

    -Alec

Viewing 2 replies - 1 through 2 (of 2 total)
  • try this onclick="JavaScript: _gaq.push(['_trackEvent', 'Next Page']);"

    Thread Starter awb9h

    (@awb9h)

    Hey Wprock,

    Thanks for the answer, but I realized I wasn’t clear. In the previous_post_link and next_post_link functions, it seems like you can only insert text before and after the link, but not in the actual link itself. What I’m trying to figure out is a work around for this.

    -Alec

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Inserting Onclick Into previous_post_link and next_post_link’ is closed to new replies.