Complete Entry

Display Ads to Search Referrals

  • Posted at: 8:42 am
  • Filed in: Design

Tags:

With the most recent design of this site I decided to do away with a few of my google ad blocks to make the site a little nicer looking. My google ads are now only displayed to those that end up here via search engines. This is really easy to do, and kinda nice if you don’t want to bombard your common visitors with ads. Below is the simple PHP used to selectively display the ads:

< ?
if (preg_match('/^http:\/\/(\w+\.)?(google|msn|yahoo|aol)\./',$_SERVER['HTTP_REFERER']) == 1)
{
?>
< ---Insert your Adsense Code Here--->
< ?
}
?>

You can see this code in action by visiting a regular post on this site and then one from google.

Comments are closed.

Date & Time

You are reading “Display Ads to Search Referrals”, an entry originally published on Thursday, September 28, 2006 at 8:42 am and filed under Design.

Commentary

There are currently 0 Comments on this entry. If you have something to say, feel free to leave a comment or post a trackback from your own site.

You can also follow the discussion through an RSS feed of this entry’s comments.

Related Entries

Recent Entries

Noteworthy Entries

Grab The Feeds