Accelerate your eCommerce ambitions with adeptCommerce Suite

SEO Egghead Consulting Group is a web development firm dedicated to creating custom, search-engine-optimized web site applications.

We specialize in eCommerce and content management web sites that not only render information beautifully to the human, but also satisfy the "third browser" - the search engine. To us, search engines are people too.

image description image description image description image description

Micro Analytics and 'How To' Examples

Some simple tools to extract referrer information and such ...

NEED A GREAT WEB SITE? NEED IT TO BE SEARCH-ENGINE-FRIENDLY?

SEO Egghead is a web development firm dedicated to creating custom, search engine optimized web site applications. We specialize in eCommerce and content management web sites that not only render information beautifully to the human, but also satisfy the "third browser" — the search engine. To us, search engines are people too. Click here to talk to us. We'd love to help!
X

Copy the following program to your PHP application folder.



Example Use:


$CFG->baseurl = 'http://mydomain.com'; // no trailing slash.
setSEReferrer(); // set referring information.
/* Then you may call getSEReferrer|getSEReferrerLandingURL|getSEReferrerDomain|getSEReferrerKeyphrase @ some point */
// Or for Google Analytics --
if ($utm_source = getSEQueryParam($row['referrer_landing_url'], 'utm_source')) $utm[] = "utm_source: $utm_source";



<?
    
    $CFG
->baseurl 'http://mydomain.com'// no trailing slash.
    
setSEReferrer(); // set referring information.

    /* Then you may call
    getSEReferrer|getSEReferrerLandingURL|getSEReferrerDomain|getSEReferrerKeyphrase */
    
    
function setSEReferrer()
    {
        global 
$CFG;
        
        if (!
$_SESSION['_referrer'] && $_SERVER['HTTP_REFERER'] &&
            !
stristr(getSEReferrerDomain($_SERVER['HTTP_REFERER']),
            
getSEReferrerDomain($CFG->baseurl))) {
            
$_SESSION['_referrer'] = $_SERVER['HTTP_REFERER'];
            
$_SESSION['_referrer_landing_url'] = $_SERVER['REQUEST_URI'];
        }
    }

    function 
getSEReferrer($session_data '')
    {
        if (!
$session_data$session_data $_SESSION;
        return 
$session_data['_referrer'];
    }
    
    function 
getSEReferrerLandingURL($session_data '')
    {
        if (!
$session_data$session_data $_SESSION;
        return 
$session_data['_referrer_landing_url'];
    }
    
    function 
getSEReferrerDomain($referer '')
    {
        if (!
$referer$referer getSEReferrer();
        
$tmp parse_url($referer);
        return 
$tmp['host'];
    }
    
    function 
getSEReferrerKeyphrase($referer '')
    {
        if (!
$referer$referer getSEReferrer();
        
        if (
           
preg_match('/www\.google.*/i'$referer)
        || 
preg_match('/search\.atomz.*/i'$referer)
        || 
preg_match('/search\.(msn|live).*/i'$referer)
        || 
preg_match('/(shopping\.)?search\.yahoo.*/i'$referer)
        || 
preg_match('/msxml\.excite\.com/i'$referer)
        || 
preg_match('/search\.lycos\.com/i'$referer)
        || 
preg_match('/www\.alltheweb\.com/i'$referer)
        || 
preg_match('/search\.(.*\.)?aol\.com/i'$referer)
        || 
preg_match('/search\.iwon\.com/i'$referer)
        || 
preg_match('/ask\.com/i'$referer)
        || 
preg_match('/search\.comcast\.net/i'$referer)
        || 
preg_match('/search\.bearshare\.com/i'$referer)
        || 
preg_match('/search\.cometsystems\.com/i'$referer)
        || 
preg_match('/www\.hotbot\.com/i'$referer)
        || 
preg_match('/www\.overture\.com/i'$referer)
        || 
preg_match('/www\.metacrawler\.com/i'$referer)
        || 
preg_match('/search\.netscape\.com/i'$referer)
        || 
preg_match('/www\.looksmart\.com/i'$referer)
        || 
preg_match('/go\.google\.com/i'$referer)
        || 
preg_match('/dpxml\.webcrawler\.com/i'$referer)
        || 
preg_match('/search\.earthlink\.net/i'$referer)
        || 
preg_match('/search\.viewpoint\.com/i'$referer)
        || 
preg_match('/www\.mamma\.com/i'$referer)
        || 
preg_match('/wisenut\.com/i'$referer)
        || 
preg_match('/home\.bellsouth\.net\/s\/s\.dll/i'$referer)
        || 
preg_match('/www\.ask\.co\.uk/i'$referer)
        || 
preg_match('/search\.myway\.com/i'$referer)
        || 
preg_match('/www\.local\.com/i'$referer)
        || 
preg_match('/goodsearch\.com/i'$referer)
        || 
preg_match('/mypoints\.com/i'$referer)
        || 
preg_match('/www\.bing\.com/i'$referer)
        ) {
        
            
$tmp parse_url($referer);
            
$tmp2 parseQueryString($tmp['query']);
            
            if (
preg_match(
            
'/(www\.google.*)|(search\.(.*\.)?aol\.com)|(search\.(msn|live).*)|(www\.alltheweb\.com)|(ask\.com)|(search\.comcast\.net)|(search\.bearshare\.com)|(go\.google\.com)|(search\.earthlink\.net)|(wisenut\.com)|(mypoints\.com)|(www\.bing\.com)/i'$referer))
                
$return = ($tmp2["q"] ? $tmp2["q"] : $tmp2["query"]);
            elseif(
preg_match('/www\.ask\.co\.uk/i'$referer))
                
$return $tmp2["ask"];
            elseif(
preg_match('/search\.atomz.*/i'$referer))
                
$return $tmp2["sp-q"];
            elseif(
preg_match('/(shopping\.)?search\.yahoo.*/i'$referer))
                
$return $tmp2["p"];
            elseif(
preg_match('/(msxml\.excite\.com)|(www\.metacrawler\.com)|(dpxml\.webcrawler\.com)/i'$referer))
                
$return $tmp2["qkw"];
            elseif(
preg_match(
            
'/(search\.lycos\.com)|(www\.hotbot\.com)|(search\.netscape\.com)|(search\.mamma\.com)/i'$referer))
                
$return $tmp2["query"];
            elseif(
preg_match('/(search\.iwon\.com)|(search\.myway\.com)/i'$referer))
                
$return $tmp2["searchfor"];
            elseif(
preg_match('/(search\.cometsystems\.com)/i'$referer))
                
$return $tmp2["qry"];
            elseif(
preg_match('/(www\.overture\.com)|(goodsearch\.com)/i'$referer))
                
$return = ($tmp2["Keywords"] ? $tmp2["Keywords"] : $tmp2["keywords"]);
            elseif(
preg_match('/www\.local\.com/i'$referer))
                
$return $tmp2["keyword"];
            elseif(
preg_match('/www\.looksmart\.com/i'$referer))
                
$return $tmp2["key"];
            elseif(
preg_match('/search\.viewpoint\.com/i'$referer))
                
$return $tmp2["k"];
            elseif(
preg_match('/home\.bellsouth\.net\/s\/s\.dll/i'$referer))
                
$return $tmp2["string"];

            return 
$return;
            
        } else {
            
            return 
'';
            
        }

    }
    
    function 
getSEQueryParam($str$name '')
    {
        if (
preg_match("#.*?[?]?([^?]*)$#"$str$matches)) $str $matches[1];
        
        
$tmp = array();
        
parse_str($str$tmp);
        
        if (
strlen($name) > 0) return $tmp[$name];
        else return 
$tmp;
    }    
    
?>


Example Screenshots:







Tell an amigo:
Sphinn Digg Reddit del.icio.us StumbleUpon Facebook