Hi there! Welcome to our blog. Don't forget to sign up for our free RSS feed. We Triple Dog Dare Ya! And thanks for visiting!
In the world of online lead generation, it’s really important to understand where your lead sources come from, particularly if they originate from a search engine query. In the code snippet below, I show you how to use PHP to discretely unpack an incoming request and figure out if it is Google or Yahoo, and if so, how to isolate the original search engine query the user entered.
$referer_string = $_SERVER['HTTP_REFERER'];
$uri = explode('?',$referer_string);
$args = explode('&',$uri[1]);
foreach ($args as $v){
$items = array();
$items = explode('=',$v);
if ($items[0] == 'q' or $items[0] == 'p'){
#we have some kind of query string from google or yahoo!
#could also use regular variable or cookie!
$_SESSION['search_string'] = $items[1];
}
}
Tags: No Comments



0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.