Which Search Engine is referring users to your site. Displays the keyword used.
Copy this code and paste it in your HTML
if ((isset($_SERVER['HTTP_REFERER'])) and
($_SERVER['HTTP_REFERER']!= '')) { $keywords = "";
// Google
if (eregi("www\.google",$url)) { preg_match("'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords); $search_engine = 'Google';
}
// Yahoo
if ((eregi("yahoo\.com",$url)) or
(eregi("search\.yahoo",$url))) { preg_match("'(\?¦&)p=(.*?)(&¦$)'si", " $url ", $keywords); $search_engine = 'Yahoo';
}
// MSN
if (eregi("search\.msn",$url)) { preg_match("'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords); $search_engine = 'MSN';
}
// AllTheWeb
if (eregi("www\.alltheweb",$url)) { preg_match("'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords); $search_engine = 'AllTheWeb';
}
// Looksmart
if (eregi("looksmart\.com",$url)) { preg_match("'(\?¦&)qt=(.*?)(&¦$)'si", " $url ", $keywords); $search_engine = 'Looksmart';
}
if (($keywords[2]!= '') and ($keywords[2]!= ' ')) {
$keywords = preg_replace('/"¦\'/', '', $keywords[2]); // Remove quotes }
echo $keywords;
echo $search_engine;
}
URL: http://www.webmasterworld.com/forum88/10984.htm
Report this snippet
Comments
Subscribe to comments