Using Adsense Channels in WordPress

by john on November 2, 2008

Seeing Sarah’s post this morning on WordPress Custom Fields got me thinking about how I use custom fields, and in particular how much easier they are to use in WordPress than back when I used to use Movable Type (I’m sure MT is better now of course). To get a feel for what we used to have to do, go read Using Adsense Channels in Movable Type.

Four years later and I still utilize Adsense Channels in the manner described in that article, however I am now doing it in WordPress, which is much easier.

Here are the four things I do to leverage Adsense Channels in WordPress:

1) Install the Get Custom Field Values plugin.

2) Create a custom channel in Adsense for the post I want to track. So that it is easy for me to determine in Google Analytics I label these channels in Google like “post104-baklava” to refer to my recipe page for the World’s Greatest Baklava, for example. On that page I only track one custom channel for all of the Adsense ads on the page. For some pages I do break out different channels for each ad location, however that makes the coding a little more complicated so for simplicity sake in this example I am just going to go with one custom channel per page.

3) In the Custom Fields section at the bottom of the WordPress post editor for the particular post I am interested in I simply add a customer field with the key of “channel” and the value of the numeric value assigned to my channel (not the friendly name I gave it in Google). For those pages where I am tracking different channels for different ad locations I add additional custom field such as “channel_sidebar”

4) Edit the adsense code in each location to use the Get Custom Field Values plugin to grab the custom channel, if it exists. For the simple example of one custom channel per page this looks like:

google_ad_channel = "<?php echo c2c_get_custom('channel','','','0997290177'); ?>";

0997290177 is the default adsense channel for that location and is what will be used if there is not a custom field called “channel” defined.

That’s all there is. The one downside to this is that you have a limit on how many channels you can make and it requires you to create custom channels for each page you are interested in, but for now I am nowhere near the limits.

Now the good news is that even this should be obsolete soon, and that is because Google will be incorporating adsense click information into Google Analytics. I don’t have it enabled yet for my site so I am not sure if it requires custom channels or not, but even if it does it should make for much better information about your ad clicks.

I hope you found this tutorial useful.

{ 2 comments… read them below or add one }

logtar November 7, 2008 at 10:06 am

I know I am doing something wrong, because after a year of using adsense and my traffic vs my ranking I have gotten next to nothing…

Silke January 22, 2009 at 5:19 am

thank you for that tip! Iím using it for my site.

Leave a Comment

{ 1 trackback }

Previous post:

Next post: