WidgetBucks CPM Location Filtering

January 25, 2008

The new widget advertising network from WidgetBucks has been getting popular recently for the higher click through rate and potential earnings. To maintain the amounts advertisers were willing to pay, they recently switched CPM ads for international traffic. Unfortunately this means that non-US & Canada visitors get lower earning non-targeted ads.

Until WidgetBucks targets non-US/Canada traffic better or provides Google-style “alternate ads”, it would be useful to be able to show something else to non-US/CA users in an attempt to maintain relevance.

Fix It

To do this there are 2 options: 1) Full on geolocation through Javascript, 2) Cheat.

As an interim measure I’ve decided to do a number 2, and below is my “solution” to the WidgetBucks problem.

Location vs. Language

Location checking is a potentially script intensive process and the intention here is to keep the script as small as possible (making updating/adding to sites as easy as possible). Although language is by no means a guarantee of location it more often than not should give good results, especially in the US and Canada (where most systems will be set to en-us and en-ca by default if not design). Helpfully, the language setting values also happen to be reasonably easy to access from within Javascript (despite some IE/Firefox differences).

The basic method we’re going to use is to check the browsers language settings on load and, depending on what we detect, display either the standard WidgetBucks ads, or something else. In the example below the “something else” is a WidgetBucks referral unit, but you might want to refer international users to other ad networks, or display a different set of ads altogether (e.g. targetted to a specific language).



else if(navigator.browserLanguage){mylanguage=navigator.browserLanguage;}

if((mylanguage.toLowerCase()=='en-us') || (mylanguage.toLowerCase()=='en-ca')){
document.write('<div><script src="http://www.widgetbucks.com/script/ads.js?uid=wnJaOtHBcojyRzmd"><\/script></div>');
} else {
document.write('<a href="http://www.widgetbucks.com/home.page?referrer=468034"><img style="border:0" src="http://images.widgetbucks.com/images/referral/adsSuck_468x60.gif" alt="Earn $$ with WidgetBucks!"></a>');

One thing to notice is that you’ll need to escape the / on the script tag (i.e. add an extra \ to make it <\/script>) in order for it to work. But the rest of the script strings and the other ad can be entered as normal. You should be able to put anything you want in the alternate ad space but remember the quotes/etc. (consult a Javascript resource guide for instructions).

With your ad set up as above, you should be able to limit your CPM ads to a bare minimum and hopefully maximise the return on your ad space!


Users outside the US/Canada who (like me) have their browsers (inexplicably) set to en-us or en-ca will still see the untargeted CPM ads. This is because although the script above will think they are in the correct area, WidgetBucks geolocation is a little bit smarter. This means that would will still get a number of CPM ad impressions, although it will be hopefully considerably reduced.

Another potential problem is for users in the US/Canada who’s first language is not English (the most obvious group being French Canadians). If the browser is set to fr-ca then they will not be shown the WidgetBucks ads, although they would be eligible for the targeted widgets. Unfortunately I’m from the UK and have little knowledge of how French Canadians set their browser-language settings, so any feedback/suggestions would be much appreciated – of course you could just add ‘fr-ca’ as an additional option into the script code.

As with everything else, please leave your comments & feedback for improving the code.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: