WordPress.org

Ready to get started?Download WordPress

Forums

Google Analytics for WordPress
Problem with Javascript links (3 posts)

  1. jonathanpdx
    Member
    Posted 2 years ago #

    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/

  2. jonathanpdx
    Member
    Posted 2 years ago #

    Please contact me if there's any assistance or more information I can provide.

    Thanks!

  3. creyes123
    Member
    Posted 2 years ago #

    I ran into this problem, too. Disabling "Track outbound clicks & downloads" seems to get around it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic