Find the Google Keyword in 2 Lines of Code
Ok, this is not meant to say I can find the Google keyword search phrase that led the user to your site in less lines of code than anyone else. It is just meant to say that it is not some giant bulk of code that a non-programmer would find impossible to use. Here it is:
preg_match_all( '/google.com/search?q=([^&]*)/i’, $_SERVER['HTTP_REFERER'], $match ); $keywords = urldecode( $match[1][0] );
Your junior PHP programmer should be able to implement this without even trying to decode anything. Actually, your junior PHP programmer should be able to take this snippet, and with very little effort extend it to all of the major search engines so that you could see not only what the user searched on to find your site, but also which engine they came from.
Now, you might be thinking… “whoop-de-do, how does this help me?”. Well, ever thought about targetting affiliate links to users on your site? Your programmer (yes, the junior programmer), should be able to take the keyword, and with little effort drop in a few related Amazon product links. Or EBay links. Or other large brand affiliate links. I say large brand, because you will want a program that can return related products for a wide range of search keywords.
Half of the battle to earning affiliate bucks is getting the right offer in front of the user. Well, the half of the battle is largely addressed with this.

