Google analytics plugin, modified

I am using the $dt->blog(); » Google analytics plugin here on this site, but for tracking outgoing link clicks I have had to modify the plugin like this:


add_filter('the_content', 'ga_addonclick', 10);

function ga_addonclick($value){

    if(get_option('ga_onclick')){

        $value = preg_replace("/<a href=\"([^\"]+)\”/e”,
        “‘<a href=\’$1\’ rel=\’nofollow\’ onclick=\”.ga_parseurl(’$1′).’\””   ,$value);
        }
        return $value;
}

function ga_parseurl($href){
    $onclickcode = stripslashes(get_option(’ga_onclick_code’));

    $href = str_replace(’http://’, ”, $href); 

    return str_replace(’$site’,$href,$onclickcode);
}




0 Responses to “Google analytics plugin, modified”


  1. No Comments

Leave a Reply