Archive for April, 2007

Invision - Monetize your IPB Lo-fi Version

Monday, April 16th, 2007

If you’ve read and implemented my method for controlling display of Google Adsense ads in Invision Power Board, you’re already reaping the benefits. But have we forgotten something? Yes, I believe we have.

Was looking through my webstats the other day (I check my popular pages and 404 errors first, then everything else), I found that some of my Lo-Fi version pages were still in my top 25 or so. Not surprising, as search engines seem to like these and have a tendency to index them first, or at least list them first. Not sure why - likely they are easier to find and index due to all the fluff being trimmed off. For a week or so I included my lofi pages in my robots.txt file to disallow them from being indexed. I’ve since rethought this approach, as I realized after digging deeper into my stats that about 15% of my page views were to the lo-fi pages.

Then I remembered reading something about ads on lo-fi pages getting higher CTR and eCPM as the nature of these provide few distractions from content, and as most visitors who hit a lo-fi page likely got there searching for something, they may be more susceptible to clicking an ad if it’s related to their search.

So can you and how do you put Adsense in your Lo-Fi pages? Easy. Here’s how:

In your IPB webroot, look for the /lofiversion folder. Go there and look for two files, index.php and lofi_skin.php. index.php contains all the functions that query and display the content. lofi_skin.php is skin wrapper, but only for the lo-fi pages.

Step 1:

Open ~/lofiversion/index.php in your favourite text editor. Notepad works. I recommend the free PSPad. Around line 612, look for:

$pages = "";

If your editor doesn’t show you lines, this is under the Print it –> Nav sections. Directly below this line, insert:

$googlebanner = "";

Next, paste your desired Google Adsense code between the double-quotes, but remember to *escape* all double-quotes within the Adsense code itself (escape means replace ” with \” - it’s a PHP thing). In the end it should look like this:

$googlebanner = "<script type=\"text/javascript\"><!--
google_ad_client = \”pub-xxxxxxxxxxxxxxxxx\”;
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = \”728×90_as\”;
google_ad_type = \”text_image\”;
google_ad_channel = \”\”;
//–>
</script>
<script type=\”text/javascript\”
src=\”http://pagead2.googlesyndication.com/pagead/show_ads.js\”>
</script>”;

Remember to escape all double quotes except the first and the last. If when you test this and your lo-fi pages are blank, you missed one so check again.

Step 2:

Directly below where you pasted the above, you’ll see a bunch of lines starting with $output - str_replace:

$output = str_replace( '<% TITLE %>' , $title , $LOFISKIN['wrapper'] );
$output = str_replace( ‘<% CONTENT %>’ , $content , $output );
$output = str_replace( ‘<% FULL_URL %>’ , $fullurl , $output );
$output = str_replace( ‘<% COPYRIGHT %>’, $copyright, $output );
$output = str_replace( ‘<% NAV %>’ , $nav , $output );
$output = str_replace( ‘<% LINK %>’ , $ipsclass->real_link, $output );
$output = str_replace( ‘<% LARGE_TITLE %>’, $ipsclass->title ? $ipsclass->title : $ipsclass->vars[’board_name’], $output );
$output = str_replace( ‘<% PAGES %>’ , $pages, $output );
$output = str_replace( “<% CHARSET %>” , $ipsclass->vars[’gb_char_set’], $output);

Below the last one, the one that says CHARSET, add the following new line:

$output = str_replace( "<% GOOGLE BANNER %>" , $googlebanner , $output );

When done, save the file and upload, overwriting your existing ~/lofiversion/index.php. Make a backup of your original lo-fi index.php if you like.

Step 3:

Open ~/lofiversion/lofi_skin.php for editing. I recommend placing your Google banner between the top nav bar and the main content (example). To do this, paste <% GOOGLE BANNER %> between the <% NAV %> div and <% PAGES %>, like so:

<div id='ipbwrapper'>
<div class=’ipbnavsmall’>
<a href=’{$ipsclass->base_url}act=Help’>{$ipsclass->lang[’tb_help’]}</a> -
<a href=’{$ipsclass->base_url}act=Search’>{$ipsclass->lang[’tb_search’]}</a> -
<a href=’{$ipsclass->base_url}act=Members’>{$ipsclass->lang[’tb_mlist’]}</a> -
<a href=’{$ipsclass->base_url}act=calendar’>{$ipsclass->lang[’tb_calendar’]}</a>
</div>
<div id=’largetext’>{$ipsclass->lang[’lofi_fullversion’]}<a href=’<% LINK %>’><% LARGE_TITLE %></a></div>
<div class=’ipbnav’><% NAV %></div>
<% GOOGLE BANNER %>
<% PAGES %>
<div id=’ipbcontent’>
<% CONTENT %>
</div>
<div class=’smalltext’>{$ipsclass->lang[’lofi_maintext’]}<a href=’<% LINK %>’>{$ipsclass->lang[’lofi_clickhere’]}</a>.</div>
</div>
<div id=’ipbcopyright’><% COPYRIGHT %></div>

The above is just what appears between the <body></body> tags so don’t worry if your files has more stuff at the top. I didn’t paste everything else. It’s a small file and you’re only adding one line. Anyway, save the file, upload, overwriting your ~/lofiversion/lofi_skin.php. Again, backup your original.

That’s it! Have a look at any of your lo-fi pages and you should now see your Google banner. w00t!


Extras, suggestions, conclusion:

Now I didn’t talk about formating or positioning. Do that by adding whatever div and styling you want to the $googlebanner section in index.php. I also didn’t go into how to limit what member groups see your ads. This is easily accomplished per my previous article, but is not necessary in lo-fi pages.

Use whatever ad format you like. I’m using two 336×250 rectangle ads side-by-side as have found that works best for my site. If you don’t like the ad postion, just change the location of <% GOOGLE BANNER %> in lofi_skin.php. You may want your ads to appear at the very top of the page or at the very bottom. Is up to you.

You can also repeat the steps above should you wish to include more ads and from other networks. Just create a separate $xxxxxbanner and str_replace line and then ad into lofi_skin.php as you like. I also have a ValueClick rectanble in my footer. Only thing that matters is that the name you give the banner define matches the str_replace, and that the macro (<% WHATEVER %>) in your str_replace matches what you paste in the lofi_skin.php file.

If using Adsense, or if your other ad network provides, I also suggest you use a custom channel in your ad code so you can track earnings from your new lo-fi ads separately, so see how they perform. You should see that the CTR and eCPM from your lo-fi ads is considerably higher than those on your regular board ads. Hey, might only make a few more dollars a day but it’s free money you’re just giving away now by not monetizing your lo-fi version.