ER/Box powered by Compiere
 
Font size:      

Apache Forrest Notes

Integration of a Google AdSense Banner

The following description refers to the integration of a Google AdSense banner placed at the top of each page.

1. Generate AdSense-Code

Log into your AdSense account and generate code for the preferred banner type. It will look something like this:

<script type="text/javascript"><!--
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "808040";
google_color_bg = "EEEEEE";
google_color_link = "2244FF";
google_color_text = "000000";
google_color_url = "B60F04";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

2. Insert AdSense-Code into Forrest Stylesheet

Insert the code above into {FORREST_HOME}\main\webapp\skins\pelt\xslt\html\site2xhtml.xsl below the opening body tag:

...
<!--+
  |HTML-body
  +-->
      <body onload="init()">
    <script type="text/javascript">ndeSetTextSize();</script>

INSERT AdSense-CODE HERE.

...

3. Make AdSense-Code Template Friendly

The inner part of the first <script> declaration has to be enclosed in a CDATA section to enable Forrest to process it as part of the stylesheet; please see the red additions to the AdSense-Code below.

...
<script type="text/javascript"><![CDATA[<!--
google_ad_client = "pub-XXXXXXXXXXXXXXXX";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "808040";
google_color_bg = "EEEEEE";
google_color_link = "2244FF";
google_color_text = "000000";
google_color_url = "B60F04";
//-->]]></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
...