Wednesday

Control Who Gets Ads | Show Adverts Only To The Right Traffic

This site explains why and how to ensure that only the correct visitors to your site get to see adverts.

Many, if not most people, show all their advertising to each and every visitor to their web site, regardless of why that visitor showed up.

This does them no favours whatever, for several reasons:

1. If a visitor is likely to be predisposed against clicking on your ads, then each time they show up and you stick adverts in their face, not only do you risk alienating these visitors, but you reduce your CTR (Click Thru Rate) each time this happens. You had a page impression - woo hoo! - but nobody clicked - boo hoo.

2. Some visitors neither welcome or expect to see adverts in certain situations - if someone is checking out your blog to decide whether to link back to you and they're confronted by a forest of ads then they may well write you off as a spam or pure adsense site - net result, lost back link and any other reciprocal favours that might have come your way.

3. If a visitor does click one of your ads, but does not really fit the profile of the kind of traffic that the advertiser is hoping to get, then it pisses that advertiser off and your earnings rate or Cost Per Click (CPC) will take a dive as a result.

This can be severely exacerbated if you're struck by a plague of Stumblers or Diggers - not only will the sheer numbers drive your CTR into the floor, but statistically you're likely to get some small percentage of clicks that nevertheless will kill your CPC credibility with your advertisers.

Many folk have wondered whether you really can make money with internet ads on blogs in particular, because while they might see traffic all right, somehow it never seems to convert to revenue.

All too often the reason is poor CTR and poor conversion. A blog typically has two types of visitor; people who want to read what you've written and people looking for something specific who have stumbled into your blog because you have, either accidentally or by design, used keywords that match what that visitor put into a search engine.

The first category will almost never click on ads and even if they do they will be unlikely to go further. Each time you display ads to one of these (non-search) visitors you're just adding 1 to your page impression count and 0 to your click count. The net result being a lousy Click Thru Rate and/or conversion rate. What then happens is that Google (or whoever) downgrade your status and your start getting crappy low paying ads (sometimes known as "smart pricing"). In other words, what little you were making before, you'll make even less in future.

The second category on the other hand are reasonably likely to click an ad, especially if they don't immediately see what they're looking for other than an advert that might look promising. It's not at all unusual to get 10% CTR or more if your traffic is well targetted (i.e. you've done a good job with your keywords to pull in folk searching for very specific stuff). Not only that, but by definition these visitors are also likely to convert well for the advertiser. Its a win-win: you're not annoying your readership, people looking for stuff might yet find it, Google's happy, the advertiser's getting targetted traffic and your blog gets sent decent ads that both attract even higher CTR and pay better.

So... what's to be done?

Simple really. Just decide who to show ads to (search engine visitors) and who to withhold advertising from (everyone else). And the simplest way to figure that out is look to see where your traffic is arriving from on a per visitor basis.

If they have blown in from a search engine (or possibly even an article directory) then there is a damn good chance they are looking for something specific, something directly related to whatever keywords you're hanging out for all to see, and something therefore that might well be a good match for your advertisers.

In a sense, Google does the job for you so long as you aren't a total Muppet about staying focused on your keywords. If your page is loaded with information about, let's say, LED Home Lighting then a) you will be ranked well for searches associated with variations on "LED home lighting" b) the adverts placed on your site will also target domestic LED lighting and similar variants and c) visitors known to have arrived via a search engine will by definition be searching for stuff something to do with LED home lighting.

Put simply, the moon will be in the seventh house and Jupiter aligned with Mars; your ducks will be arranged sequentially and the loot will begin to flow.

So, it’s good to know where your visitor has come from, and particularly to know whether they have arrived via a Search Engine. At this point it’s time to drop the pretence; we’re basically talking about Google here.

Yes, we can identify other brands of search engine and even article directories or other likely indicators that a visitor is looking for something we might just have a tempting advert or three for. But Google is the big beast in this jungle by some considerable margin.

Now the great thing about Google is that the referrer text follows a pattern from which we can extract even more useful information about our visitor. Here’s an example:


http://www.google.co.uk/search?
sourceid=navclient
&aq=t
&hl=en-GB
&ie=UTF-8
&rlz=1T4GZEZ_en-GBGB267GB267
&q=control+adsense+on+blogger



Amongst other things, we can tell that this visitor is located in the United Kingdom and has performed a simple search for the keyword term “control adsense on blogger” (but without the quotes). Had the visitor used quotes or performed an advanced search we could just as easily identify the necessary components.

This is potentially very useful. We want visitors from search engines because they are most likely to be drawn to the adverts, but there may be circumstances where we still want to block ads even to search engine traffic. Knowing the geographic location of the search engine and/or the exact search term can provide additional capability.

If your web site had a problem with being overrun by Hungarians for example (maybe you accidentally used a keyword that has an unfortunate meaning in another language and so attracts the wrong sort of visitor from that country), you could quite easily determine whether a visitor had originated from Google Hungary (www.google.co.hu).

Similarly, it’s not uncommon to find search engines sending traffic to your web site that matches some keyword(s) that are completely incidental to the main theme of your site. You might be heavily targeting say “blogger adsense gadgets” but have inadvertently also entirely cornered the small but persistent market in “adjustable surgical trusses”.

It could be useful to identify your non-core visitors and either simply withhold your primary advertising or offer them something else (an appropriate affiliate link or ads for Amazon or whatever). In this way, you don’t send out mixed messages to different categories of visitor and you can also serve different types of advertising but without ever having them appear on the same page at the same time.

But enough of the schpiel, let’s see how to do actually do this.

There are two general ways of going about this: server side code and browser code. In the blogging world this boils down to a PHP based solution as favoured by WordPress blogs and a JavaScript solution which is easy to apply for Blogger BlogSpot blogs.

Regardless of the implementation specifics, we also need to consider whether to show adverts only at the moment a visitor arrives via a suitable search term, or to keep showing such visitors ads if they stay on our site and click to another page (which may or may not be so well targetted at the keyword by which they first arrived).

I do in fact have solutions written in both PHP and Javascript and with the capability to keep ads enabled for visitors who decide to stay. However, to keep things simple for now, I am presenting only the JavaScript version that only enables adverts for visitors arriving directly from a search engine, because in practice most people either click on an ad straight after they arrive or they start to read, in which case they’re pretty much a lost cause as far as adverts are concerned.

If anyone has a pressing need for one of the other variants mentioned above then drop me a line and I'll see what I can do for you.

So here it is. For Blogger bloggers you need to add the following script entry to the Page Elements section of your blog. Basically, click Customize then select Layout and Page Elements. Click Add a Gadget then select HTML/Javascript and cut/paste the code below into the window, leave the title blank and Save it.

Ensure that this Gadget is at the TOP of the list of Gadgets.

Now you can put conditions around your adsense (or other advertising) code. Examples are shown further on.


<script type="text/javascript"><!--

/*
This script reveals how a visitor has arrived at your site. The main
purpose being to decide whether or not to display advertising.
If the referer is a search engine for example, then you probably do
want to show ads, otherwise not since showing ads regardless can
be detrimental to your performance as perceived by the ad owners.
*/
// These get set here...
// The full referer details for your visitor
var referer;
// Domain name of the site where your visitor came from
var refererDomain;
// Indicates whether the visitor arrived via Google
var isGoogle;
// Indicates geographic location if arrived via Google
var googleDomainSuffix;
// The search term used if a visitor has come from google
var googleSearchTerm;
// Whether you should display advertising or not
var showAds;

/*
List of expressions that indicate whether a referer is a search engine, article directory, etc. Re-configure this to suit yourself...
*/
var adReferers = ['/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.', 'EzineArticles', 'goarticles'];

// Lets figure stuff out...
referer = document.referrer;
var myDomain = document.location.host;
var refererParms = referer.split('&');
var refererUrl = refererParms[0].split('/');
refererDomain = refererUrl[2];
isGoogle = false;
if (refererDomain.substr(0,10) == 'www.google') {
isGoogle = true;
googleDomainSuffix = refererDomain.substr(10);
}
googleSearchTerm = "";
showAds = false;
var i = 0;
if (isGoogle) {
for (i = 0; i < refererParms.length; i++) {
if (refererParms[i].substr(0,2) == 'q=') {
googleSearchTerm = refererParms[i].substr(2).replace(/\+/g,' ');
}
if (refererParms[i].substr(0,5) == 'as_q=') {
googleSearchTerm = refererParms[i].substr(5).replace(/\+/g,' ');
}
}
}
for (i = 0; i < adReferers.length; i++) {
if (referer.indexOf(adReferers[i]) != -1) {
showAds = true;
break;
}
}
//--></script>



In order to use this code, you must insert your adsense code either directly into your template HTML or via HTML/JavaScript gadgets NOT using AdSense gadgets. That is because now you need to surround the adsense code with conditional logic like the following.


<script type="text/javascript"><!--
if (showAds) {

google_ad_client = "pub-000000000000000";
/* Skyscraper */
google_ad_slot = "0000000000";
google_ad_width = 160;
google_ad_height = 600;
}
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>



Here’s something a bit more sophisticated, just to give an idea.


<script type="text/javascript"><!--
if (isGoogle && googleDomanSuffix == “.co.hu”) {
// It’s those darn Hungarians again – lets see what they want
if (googleSearchTerm == “goulash”) {
// send em on their way…
window.open("./all_about_soup.html", "_self");
}
}
//--></script>



Anyway, feel free to copy, use and modify this anyway you like. If you need some help or want to suggest improvements then just contact me and I'll do what I can.

If you find it useful then a short mention would be nice, nothing fancy, something simple tucked away in your next post like for example:


Found this great Blogger Gadget to
<a href=”http://controlwhogetsads.blogspot.com/”>Control Who Gets Ads</a>.



Aside from showing off that you’re savvy about selective advertising, the old adage “what goes around comes around” remains sound advice and especially so in the online world.

There is no better way to demonstrate that you are a person who reciprocates and is good to do business with than simple old fashioned courtesy. And with that in mind, do yourself a favour and pay a visit to Grizz if you're looking for some sound advice on how to actually make money with a blog.

Of course the foregoing advice only applies if you're using your website as a conduit for other peoples products via advertising. If you have your own products (or simply the rights) to sell then you don't want to send your visitors away via an adsense click - you want them to BUY stuff. For that you really should consider the 7 Dollar Script.