Support » Plugin: MonsterInsights - Google Analytics Dashboard for WordPress (Website Stats Made Easy) » [Plugin: Google Analytics for WordPress] Problem with Javascript links

  • Problem: Google Analytics is breaking my Javascript-based hrefs in my anchor tags. I believe the problem is that it gets confused because I have a pair of single quotes (‘) inside a pair of double quotes (“).

    The problem appears to be either in GA_Filter::ga_parse_link or the regular expression that is passed on line 1220 of googleanalytics.php:

    static $anchorPattern = '/<a (.*?)href=[\'\"](.*?)\/\/([^\'\"]+?)[\'\"](.*?)>(.*?)<\/a>/i';

    What ends up happening is that a URL that looks like this:

    <a href="javascript:launchWS('http://full_url_with_args');">here</a>

    will have the Google Analytics plugin turn it into the following:

    <a href="javascript:launchWS('http://full_url_with_args" );">here</a>

    Note how the closing single quote is turned into a double quote. Neither Chrome or Firefox interpret these as Javascript so the links fail to function.

    Any chance we can see a fix for this?

    http://wordpress.org/extend/plugins/google-analytics-for-wordpress/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Google Analytics for WordPress] Problem with Javascript links’ is closed to new replies.