Plugin Directory

Opened 4 years ago

Last modified 4 years ago

#2253 new defect

Plugin: GA Link Tracker | Missing spaces affects plugin's usability

Reported by: lauriemrauch Owned by:
Priority: normal Severity: critical
Plugin: not-listed Keywords: ga-link-tracker



I'm using this plugin (http://wordpress.org/plugins/ga-link-tracker) on a client's site and we ran into a few issues with it. First, the plugin affects all tags that start with the letter a - abbr, aside, etc, thus breaking them... As well, there's no space after the inserted code, so it's adding it into the href attribute, making neither work correctly. If you tweak the function to add these in, as so:

function GA_Link_Tracker($content){
    if (preg_match('/href="([^"]*)"/i', $content, $regs)){
        $result = $regs[1];
        $needle = "<a ";
        $content = str_replace($needle, "<a onclick=\"ga('send', 'event', 'Links', 'click', '". $result ."');\" ", $content);
    return $content;

everything loads as it should without breaking anything.

Hope that helps!

Change History (1)

comment:1 @lauriemrauch4 years ago

  • Severity changed from normal to critical
Note: See TracTickets for help on using tickets.