Using AdSense Channels with Movable Type

by john on July 14, 2004

Many webloggers have incorporated Google’s AdSense into their weblogs as one of the new ways to make money online – it’s a simple, relatively unobtrusive way to generate a little bit of secondary income. Until recently it was impossible to know which pages were generating revenue but with the introduction of channels a few months ago Google opened up a whole new way to look at the data. Channels allow the AdSense user to see exactly what pages are the biggest revenue generators, but until now such insight had been unavailable to the average weblogger. This article shows how you can use channels to pinpoint which articles or other pages on your weblog are generating the most revenue.

Who should read this article

I am a Movable Type user and as such have written this article specifically for Movable Type. However the concepts should translate to any other weblogging tool so in general any weblogger that has been approved for the AdSense program should benefit from this article.

Requirements

The approach outlined in this article has been tested using both Movable Type 2.661 and 3.01D. Two plugins are used – Brad Choate’s Key Values and Regex. Obviously you must be approved for Google’s AdSense program.

Installing the Key Values plugin

Brad Choate’s brilliant Key Values plugin offers a simple way to extend the built-in fields of Movable Type. We will be using this plugin to insert the unique channel id into any article. Before I go on to describe exactly how to do that you should make sure you have this plugin installed. I won’t rewrite Brad’s installation instructions here so please get it installed before continuing.

Brad’s Regex plugin is not needed unless you use the MTIfExtended tag in your template – see below for an example.

Creating the channels

Most webloggers have a main page with the last n articles, various archives pages and individual article pages. I suggest creating one channel for your main page, another for each archive type you have, a default channel that will be used for individual articles where you have not specified a channel and one for every article you want to monitor. Take care, however, as Google currently limits you to 50 active channels. What that means is you will want to keep tabs on a subset of your articles – probably the most heavily viewed or the ones you put the most effort into. Wouldn’t it be nice to see your hard work paying off by seeing exactly how much revenue a specific article is generating for you?

Follow Google’s directions for creating a channel. Below is an example of what part of your code might like look. Here 0123456789 is the unique channel id you will be inserting into your template or articles.

google_ad_width = 728;
google_ad_height = 90;
google_ad_format = “728x90_as”;
google_ad_channel =”0123456789″;

Create a channel called “Main Page”, one called “Archives”, one called “Default Article” and then two or three more representing a few test articles. Be sure to use descriptive names.

Adding a channel to an article

I’m going to jump ahead of the game just a little to describe how you are going to be adding this channel data to some of your articles, then we’ll proceed to making the template changes necessary to support this approach.

The channels called “Main Page”, “Archives” and “Default Article” will all be used within your templates as you will see below. However the channels you created for individual articles will actually be entered in the article itself, in the MTEntryMore field (the Extended Entry text box of the Movable Type edit screen).

Here is an example of the simplest case were you don’t actually use that field for your article so it only contains the key/value pair:

ee-blank.jpg

And as you can see if you do actually use that field adding the channel isn’t much different:

ee-data.jpg

At this point you may be saying to yourself, “I don’t want that crap to show in my article.” Ah behold the magic of the MTKeyValue plugin. With the appropriate template changes nobody will be the wiser.

Template changes

Now that you have your channels created and you know how to add the individual ones to your articles you will need to edit a few of your templates. There are two considerations here. The obvious change is that you need to change each template that contains the Google AdSense code to point to the custom channel for that page. Then, because of our overloading the MTEntryMore field we need to make sure the channel data is stripped from that field when it is displayed in any template.

Let’s start with the simplest change. One of the channels you created was called “Main Page”. Go to the template (default name is Main Index) that contains the AdSense code that is displayed on your main page, assuming you have the ads showing there, and simply update the AdSense code to include the channel id. It will look just like the code fragment above that came straight from Google. At this point you really haven’t done anything too tricky. Whenever a user clicks an ad on your main page that will register the click through to the Main Page channel. If your site is like mine where most people arrive through a search to an individual article then it is likely you won’t see many hits from the main page. Still, the point of this article is that you can begin to find that stuff out!

Do the same thing for your Archives channel and your archives templates. You can either use the same channel for all your archive types or if you are interested in seeing whether a particular archive type does better for you then obviously you can create multiple archive channels. Keep in mind the 50 channel limitation, however.

To this point we haven’t done anything very dynamic but that is about to change. I think the real value to this approach is the granularity – seeing your revenue at the article level. Let’s take a look at the changes we need to make to your Individual Entry Template (default name is Individual Entry Archive). The first thing we need to do is again make the change to the Google AdSense code although this time we aren’t just entering a simple channel id. Here is what mine looks like:

google_ad_channel = "<mtkeyvalues></mtkeyvalues>
<mtkeyvalue default="0123456789" key="channel"></mtkeyvalue>";

(That should all be on one line). The opening and closing MTKeyValues is the container tag for accessing the key/value data via the MTKeyValue plugin. The MTKeyValue tag is saying “if there exists a key named channel then use that value, otherwise use the default value of 0123456789.” This value would be a real number, the number you generated for your Default Article channel above.

At this point your work with the channels is done. In fact if you stopped right now you would have access to your custom channels and if you looked at the source for a couple of your test articles you would see the correct channels being used. However there is one problem. Remember the “channel=0123456789” line we put into the Extended Entry? You need to tell Movable Type to strip that line out when it builds your site. That data needs to be invisible to the reader. Here’s how to do that.

In your Individual Entry Template you should have a section that looks something like this:

<$MTEntryBody$>
<$MTEntryMore$>

All it’s doing is printing out the Entry Body and then the Extended Entry right after it. That’s what you want but you just want to make sure your key/value pair doesn’t show u That’s easy:

<$MTEntryBody$>
<mtkeyvalues></mtkeyvalues>
<$MTEntryMore$>
;

The MTKeyValues tag does all the work and automatically strips the key/value data out so what’s left is just whatever you had in the Extended Entry field. All I did here was wrap the <MTEntryMore> tag with the <MTKeyValues> tag and you should simply repeat that across all of your templates that reference the MTEntryMore field. Don’t forget to fix your RSS templates.

One thing I ran into on my main page template was the code that hides the Extended Entry text from the user. The logic of that code is quite simple – “if there is no extended entry data then just show the body of the article. If there is extended entry data then show a clickable link that when clicked will display the extended entry data.” The code itself looked something like this:

<mtentryifextended></mtentryifextended>
… do stuff …

If you’ve been paying attention you probably have figured out the problem. If I have an article that doesn’t use the Extended Entry field other than to insert a channel id then my code would think there is an extended entry and display the link – but there would be nothing behind it because the MTKeyValues tag had stripped the key/value out. Here is how I (with some help) worked around that:

<mtkeyvalues></mtkeyvalues>
<mtentryifextended></mtentryifextended>
<mtifmatches expr=”[MTEntryMore]” pattern=”m/\S/”></mtifmatches>
… do stuff …

The MTIfMatches tag comes from the Regex plugin. You only need that plugin if you have this unique situation.

At this point you should be good to go.

Where to go from here

The first thing I need to point out is that you will not immediately see the impact of your work. Channel data seems to be two or three days behind so have some patience – it will take a little bit of time before you start seeing the channel data in your reports.

In this article I’ve given you a framework for incorporating Google’s AdSense channels into your weblog for the purpose of better understanding where exactly your revenue comes from. Because of the limitations of the number of channels you can create, however, you will need to apply some logic to which articles you flag and you will need to keep that up to date as you add new articles – fortunately Google makes it very easy to inactivate channels so you can control that completely within Google without having to go back to your old articles. Simply leave the channel data there.

If you have any trouble getting this implemented please leave a comment below or email me and I’ll try to help.

I hope you have found this article useful and can use this approach to tweak your site to increase your AdSense revenue. If you feel you can quantify an increase in revenue as a result of this article then I would greatly appreciate any donation you feel is appropriate. Please click on the button below to throw some love my way.

Thank you and good luck.

More AdSense Tips.

{ 9 comments }

Pathways July 14, 2004 at 10:22 am

http://www.confusedkid.com

John’s Jottings: Using AdSense Channels with Movable Type, for the thousands that read this blog…

john July 14, 2004 at 8:18 pm

I wonder if this guy will be stopping by? Looks like I wrote what he is looking for. $500? Heck, I’ll take $25. 🙂

http://www.rentacoder.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=151019

C:Arvind.sideblog July 18, 2004 at 12:35 am

Adsense and MT

Using AdSense Channels with Movable Type…

Learning Movable Type July 18, 2004 at 12:02 pm

How to Make Money with Your Blog

There are two approaches to making money with a weblog; one is to create a blog specifically for the purpose of making money, the other is to earn some money as a by-product of your site. This tutorial will focus primarily on the second approach. If yo…

elise.com: On the Job July 18, 2004 at 12:05 pm

Google Adsense, Ad”sensibilty” that is

Google continues to turn the search engine world upside down. For years, advertisers have been paying for high placement in search results for keyword searches on Yahoo, Alta Visa, and Google. Overture, recently bought by Yahoo, built its business by b…

Chinwags From Abu Dhabi July 21, 2004 at 1:53 am

Advertising

The whole part of my morning today was taken up in trying to implement Google Adnsense onto my individual pages. I decided to only incorporate them on individual archive pages because well they are quite annoying and I didn’t want…

Notes to Myself September 20, 2004 at 5:46 am

Google AdSense

AdSense – Can bloggers recoup costs?

网站推广 October 13, 2005 at 3:45 am

Group pages into channels is a good resolvent to see how one domain is performing as opposed to another. It will help us maximize our revenue on all pages.Thank you!

Rajeev Edmonds from Adsense Primer February 10, 2008 at 8:00 am

If you are maintaining several sites, it is good to append domain name in channels, it helps in segregating the data easily in Adsense reports.

{ 9 trackbacks }

Previous post:

Next post: