开发者

best way to parse analytics to find referrer?

for example...

if(isset($_GET['utm_blah'])) { $referrer = $_GET['utm_blah'; }
else { $referrer = $_SERVER['HTTP_REFERER']; }

looking to parse referrer sent by google adwords, or twitter, or email, ... etc开发者_StackOverflow. thanks!


A little snippet

if(isset($_SERVER['HTTP_REFERER'])) {
    $in['ref']  = $_SERVER['HTTP_REFERER'];
} 
//...
if(isset($in['ref'])) {
    $found=false;

    /* referrer on same domain ? */
    if(isset($in['domain'])) {
        $refdomain=eregi_replace("^www.","",parse_url($in['ref'],PHP_URL_HOST));
        if($in['domain']==$refdomain) {
            $found=true;
        }
        unset($refdomain);
    }

    /* check referrer ignore list */
    if($found==false && is_file('refferer.ignore.txt') && filesize('refferer.ignore.txt')>0) {
        $ignorelist=explode("\n",file_get_contents('refferer.ignore.txt'));
        $maxi=count($ignorelist);
        if($maxi>0) {
            $i=0;
            while(false===$found && $i
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜