[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('https://full_url_with_args');">here</a>
will have the Google Analytics plugin turn it into the following:
<a href="javascript:launchWS('https://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?
https://www.ads-software.com/extend/plugins/google-analytics-for-wordpress/
- The topic ‘[Plugin: Google Analytics for WordPress] Problem with Javascript links’ is closed to new replies.