psst.. this blog is on hiatus.

Chitika as Adsense alternate ads - keyword targeting in Movable Type

Background — are you maximizing your ad revenue potential?

If you’re using AdSense, there’s a good chance you’re losing revenue by going with the default PSA (public service announcement) ads. These ads pay nothing to the publisher and are inserted when AdSense cannot find normal, contextual ads for your page. If you’re going with a fallback color (google_alternate_color), you’re also losing potential revenue.

The solution is to specify alternate ads from another ad system, which are inserted if AdSense doesn’t have any ads for your page. This is done in the AdSense with the option labeled Show ads from another URL. The value entered in the setup becomes the google_alternate_ad_url in the AdSense javascript.

Chitika, a solid AdSense alternative

Chitika (aff) is an excellent alternate to Google AdSense. Their tabbed ads are an interesting departure from Google’s pure text ads, and their CPC (cost per click) rates are generally pretty good. Chitika offers product-focused ads, so if you have a website that maps well to this area—such as a blog about gadgets or cameras—you’re in like Flynn.

Chitika (aff) can be used as a contextual system (like AdSense) or as a “dumb” ad system which has to be fed keywords. By default, it’s set up in “dumb” mode (ch_non_contextual = 1), which complies with Google’s TOS. In non-contextual mode, however, you must specify keywords in the Chitika javascript to get targeted ads. And since Google only gives you one variable — google_alternate_ad_url — to specify alternate ads, that’s the tricky part. How can you get targeted ads by calling a URL?

Using the query string to target Chitika ads

The answer is the URL itself. You can specify keywords as part of the query string in the URL. For example:

google_alternate_ad_url = "http://www.yoursite.com/alternate-ads/chitika.shtml?'keyword1','keyword2','keyword3'";

It’s very important in the above code that you pay attention to the quoting; if you separate the keywords via a single quote, make sure you delimit the ad URL string via double quotes.

The now-targeted Chitika ad can then be called quite simply. You need an shtml page, not a regular html page, to access the query_string and echo it in the html source (via an XSSI directive in Apache). (This can also be done trivially via PHP, ASP, etc., but I’ll just cover shtml here).

Given the above example URL, here’s a sample web page that will target Chitika ads called via the Adsense google_alternate_ad_url.

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>

<style type=”text/css”><!–
body { background-color: #ffffff; }
–></style>

<title>alt</title>
</head>
<body>
<script type=”text/javascript”><!–
ch_client = “YOUR_CLIENT_ID”;
ch_width = 300;
ch_height = 250;
ch_color_border = “ffffff”;
ch_color_bg = “ffffff”;
ch_color_title = “000000″;
ch_color_text = “333333″;
ch_non_contextual = 1;
ch_nosearch = 1;
ch_default_category = “200001″;
ch_sid = “rectangle”;
var ch_queries = new Array( <!–#echo var=”QUERY_STRING” –> );
var ch_selected=Math.floor((Math.random()*ch_queries.length));
if ( ch_selected < ch_queries.length ) {
ch_query = ch_queries[ch_selected];
}
//–></script>
<script src=”http://scripts.chitika.net/eminimalls/mm.js” type=”text/javascript”>
</script>
</body>
</html>

The colors in the example will need to be modified to match your website.

Configuring Movable Type to call Chitika with keywords in the URL

If you use MT’s keywords field (MTEntryKeywords), you’ll get the best results here. It’s also smart to include the title (MTEntryTitle), as that should have relevant words, too. This section on Movable Type is slightly advanced, so please attempt only if you’re pretty familiar with MT. If you’re a total n00b, please don’t ask me n00b questions. :)

This code requires the following plugins:

I’m using the following regular expressions:

<MTRegexDefine name=”removeKeywordJunk”>s/(\[|\]|\{|\}|\’|\,|\”)//g</MTRegexDefine>
<MTRegexDefine name=”space2comma”>s/ /’,'/g</MTRegexDefine>

And then this code for the google_alternate_ad_url in AdSense units in your MT templates:

google_alternate_ad_url = “http://www.yoursite.com/alternate-ads/chitika.shtml?’<$MTEntryTitle regex=”removeKeywordJunk space2comma”$>’,<MTIfNotEmpty var=”EntryKeywords”><MTGlueContainer><MTKeyWordList>’<$MTKeyWord regex=”removeKeywordJunk”$>’<MTGlue>,</MTGlue></MTKeyWordList></MTGlueContainer></MTIfNotEmpty>”;

Don’t mess with the commas and regex; I’ve got it right so that all keywords will be delimited properly via single quote (and it’s kind of a pain to figure out). Remember, if you have differently sized AdSense units on your page, you’ll need to create different versions of “chitika.shtml” to call the proper Chitika ad size. You might create chitika468x60.shtml, chitika160x600.shtml, etc.

Conclusion

If you found this article useful, consider joining Chitika using my referral link. :) Here’s my AdSense link:

Also, for all you WordPress gurus out there (I wish I were on it), feel free to post the code for WP.

Comments are closed.