free stats
Utills.com mail me @ utills@utills.com! sindicaci;ón

Choosing Who To Show Ads To

Since the blog is run on PHP, it is easy to selectively show ads. Depending on the “http referrer” and the “user agent” I choose what ads to show. For example the following code allows me to only show the Firefox Referral to those whose browser reports them as not having a Gecko based browser.

<?php

$strGecko = strpos($_SERVER['HTTP_USER_AGENT'], “Gecko”);

if ($strGecko == ”){ ?>

…….. put HTML code here …………

<?php } ?>

I’m not sure what user agents different browsers report so this is just experimental at this stage. I know that some users used to change their user agent to Internet Explorer so that websites that didn’t recognise Firefox would treat them the same, but I think that practice has now ceased due to the increased awareness of Firefox.

Another variable on which to base what ads to show is the HTTP REFERER (spelt with 3 R’s for some reason). Currently if the referrer contains Google, Yahoo, etc in the link then for a single blog post I show Google Ads. Of course it is important to make sure that the referrer does actually come from Google or Yahoo sites and not just any URL containing google in it.

To check who sent the user to you, use the following code:

<?php $referrer = $_SERVER['HTTP_REFERER'] ?>

Then you can manipulate the $referrer String how and when you want. Often a good strategy is to give regular readers an ad free page but show ads to other readers who perhaps come from other sites, more often than not looking for something in particular. The following criteria could be used:

  • Only show ads on older articles i.e. if article is older than 10 days then show ads
  • Show ads to anyone coming from a seach engine (Google,Yahoo, Technorati, etc)
  • Show ads to any referral i.e. anyone who links to a single blogpost
  • Show product referrals based on browser/OS/screen size/location etc

In general it is a good idea to try not to annoy regular readers but use ads as a way of helping users find what they are looking for.

· Posted by Utills

Post Comment