AdSense and Community Server
Though I focus on Google Adsense in this article I would
suspect other providers would work very similarly. There are couple of areas that need to be
understood to get this all to work together.
Overview
You will need to set up an account with Adsense. They will then review your application and
decide if your content meets their criteria.
I can't say exactly what their criteria will be, but most general audience
sites would probably be approved. They
will not approve adult content. Once Google gives you an account you can log in and create the injection
scripts you will need in the steps outlined below.
Editing the Skin file
The first skin file you will want to modify is Skin-Ads.ascx
which is in the /Themes/default/Skins directory. You can copy this to your desired skin
directory if you desire. A reason you may
choose to do that is so ads only showing up on a blog for example. The Community Server skinning system will
use the skin hierarchy to find the right file.
The first thing you want to do is delete:
<div align="center"
style="padding-top:5px;padding-bottom:5px;">
<iframe width="486" height="60"
marginwidth="0" marginheight="0" hspace="0"
vspace="0" frameborder="0" scrolling="no"
bordercolor="#000000" src="http://www.communityserver.org/Banner.aspx?z=1">
</iframe>
</div>
from the StandardTop span.
This code is only a place holder for Community Server and will display
when you turn on ads later. If you
copied you skin file to a different l skin directory you will also want to
delete this from the Skin-Ads.ascx in the default theme so that you don't get text
in other parts of you site when you turn on ads.
You will notice inside the Skin-Ads.ascx there are six span
tags: StandardTop, Square, Skyscraper, StandardBottom, GoogleAdsense, and Inline. You can use all of these for Adsense, you are
not limited by the span named GoogleAdsense. One thing to remember is Google will only display up to
three ad blocks per page, so don't put more then three on any given page. Anything after the third one in the rendered
html will be blank.
Add your different channels within different spans in your
skin-ads file and save it when you are done.
As way of example here is the abbreviated skin file for this site:
<%@ Control Language="C#" %>
<span id="StandardTop" runat="server" visible="false">
<script type="text/javascript"><!--
...
google_color_url = "ECECEC";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</span>
<span id="Square" runat="server" visible="false">
<script type="text/javascript"><!--
....
google_color_url = "336699";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</span>
<span id="Skyscraper" runat="server" visible="false">
</span>
<span id="StandardBottom" runat="server" visible="false">
<br/>
<script type="text/javascript"><!--
...
google_color_url = "336699";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</span>
<span id="GoogleAdsense" runat="server" visible="false">
<div class="AdsenseArea">
<script type="text/javascript"><!--
....
google_color_url = "336699";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
</span>
<span id="Inline" runat="server" visible="false">
</span>
Then you are going to want and add lines like
<CS:Ads ID="Ads1" Zone="Square " runat="server" />
Make sure the ID attribute in unique for each <CS:ads.. on your page. Zone should the span name from the skin-ads.ascx file.
On this site I am running it with just the one blog, and I am not worried about ads in other sections. If you are running a full blown Community Server install you may want search all you skin files for Zone=" and see which zone might show up where.
Okay, we are ready to turn them on. Go to Control Panel / Administration/ System Tools. Select Manage ads.
Select enable ads, for now uncheck the SystemAdminstrators from the role to exclude and press save. The ads should appear where you put the <CS:Ads elements. If thing aren't right uncheck enable ads hit save. Now no ads go back adjust your shins and try again. Note it could take some time before relvent ads appear. Google will need to index your site and match content to ads.
Hope this helps. If you choose to join Adsense, do me a favor and use my referal link by clicking on the adsense icon in the left nav.
Love to hear about your success in getting this running on your site.
Please note: After writing this blog entry it came to my attention that you must be running Community Server Comercial Editon to use AdSense. It is excluded from the Personal Edition in the EULA.