Forums

[Plugin: Google Analytics for WordPress] Track Outbound Links sometimes breaks existing onclick hand (1 post)

  1. DanielStutzbach
    Member
    Posted 2 months ago #

    If I enable "Track Outbound Links and Downloads", the plugin adds an onclick event to outbound links. Mostly, this works great. If an outbound link already has an onclick event handler, the plugin inserts the tracking code before the other event handler, so that both can execute. Mostly, this works great, too.

    However, the plugin doesn't appear to does correctly with single-quotes inside of the original event handler. Here's an example:

    Original onclick handler:

    onclick="return hs.expand(this, { autoplay: false, slideshowGroup: 'group1' })"

    With Track Outbound Links and Download:

    onclick="javascript:pageTracker._trackPageview('/outbound/article/http://lh6.ggpht.com/_M0_7MTlp6dI/SeY0UIjrPzI/AAAAAAAAFug/jYK__i3dlJs/DSC00001.JPG?imgmax=800'); return hs.expand(this, { autoplay: false, slideshowGroup: "group1' })"

    The problem is right near the end, where 'group1' has become "group1'. A single-quote has become a double-quote. That closes the event handler text, breaking the JavaScript as well as the surrounding HTML.

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 2 months ago by DanielStutzbach
  • WordPress version: 2.8.4
  • This topic is not resolved