SE search string for your dynamic landing page
Lately I discovered a nice little but useful script to make a landing page even more dynamic. This script delivers the Google search string provided trough the HTTP_REFERER to a variable in order to put it on i.e. into the title or meta tags on your landing page. This can improve quality score or quality of user experience who are visiting your site, if done correctly.
<?php
// take the referer
$referer = strtolower($_SERVER[’HTTP_REFERER’]);
// see if it comes from google
if (strpos($referer,”google”)) {
// delete all before q=
$a = substr($referer, strpos($referer,”q=”));
// delete q=
$a = substr($a,2);
// delete all FROM the next & onwards
if (strpos($a,”&”)) {
$a = substr($a, 0,strpos($a,”&”));
}
// we have the results.
$googlekeywords = urldecode($a);
}
?>
and then put <?= $googlekeywords ?> whereever you want to integrate the keyword in your landing page.
I created a customized one for Yahoo just for you guys:
<?php
// take the referer
$referer = strtolower($_SERVER[’HTTP_REFERER’]);
// see if it comes from yahoo
if (strpos($referer,”yahoo”)) {
// delete all before p=
$a = substr($referer, strpos($referer,”p=”));
// delete p=
$a = substr($a,2);
// delete all FROM the next & onwards
if (strpos($a,”&”)) {
$a = substr($a, 0,strpos($a,”&”));
}
// we have the results.
$yahookeywords = urldecode($a);
}
?>
call it by placing <?= $yahookeywords ?>
and last but not least MSN:
<?php
// take the referer
$referer = strtolower($_SERVER[’HTTP_REFERER’]);
// see if it comes from MSN
if (strpos($referer,”msn”)) {
// delete all before q=
$a = substr($referer, strpos($referer,”q=”));
// delete q=
$a = substr($a,2);
// delete all FROM the next & onwards
if (strpos($a,”&”)) {
$a = substr($a, 0,strpos($a,”&”));
}
// we have the results.
$msnkeywords = urldecode($a);
}
?>
call with <?= $msnkeywords ?>
feel free to customize this stuff even more ![]()









Hi! My name's Luke. I make a living online. Mainly with affiliate marketing. That's the big share on top of the smaller adsense income earned by my blogs. It's big bucks for me and maybe 100x a normal salary here, as I'm travelling and living in Thailand since 2 months now. I mostly work the mornings in small internet shops, like hang out im the afternoons getting tanned and enjoy the nights partying and having fun with friends. I just love this lifestyle. Maybe you can join me soon? :-)