Home
Getting Started
Solutions
AddThis Bookmark
Audio/Video
Bravenet Services
Custom Site
Forms: Allforms
Forms: Bravenet
Google Gadgets
Google Webmaster
Image Enlarging
Links in New Window
Mouse Trail
Redirect
Remove
Password Gate Generator
Paypal
Popup Generator
Site Search
Splash Page
Slideshow Generator
Webpage Translation
Google Adsense
Google Analytics
Tutorials
Tips
SE Optimization
Customizing OL
Help and How To
Downloads
Services
Office Live Video
Common Problems
Contact Us

How to add Google Adsense Ads (XSLT)

This method inserts the Google Adsense ads directly into the page, without violating Google's Terms and Conditions.  If you put Google Adsense code into the HTML module, you will violate Google's Terms and Conditions, which result in getting kicked out of Google Adsense! 
 
1. Sign up for a Google Adsense: http://google.com/adsense
 
2.  Create your ad and copy the code into notepad.
 
3.  Add <![CDATA[  before the comment tags (<!--) and ad ]]> at the end of the comment tags (//-->), like the example below.  This does not violate the terms and conditions because tags will be removed when the page is rendered.
 
Before adding <![CDATA[ ]]>:
<script type="text/javascript">
<!--
google_ad_client = "pub-4773491283295080";
/* 160x600, created 4/1/08 */
google_ad_slot = "0237614524";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="
http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
 
What the code should look like:
<script type="text/javascript">
<![CDATA[<!--
google_ad_client = "pub-4773491283295080";
/* 160x600, created 4/1/08 */
google_ad_slot = "0237614524";
google_ad_width = 160;
google_ad_height = 600;
//-->]]>
</script>
<script type="text/javascript"
src="
http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
 
4.  Next insert a Custom Footer module into the page, you will need advanced design features turned on before you can do this.
 
5.  Either, remove everything between the <template> tags so that it looks like to the code below, or you can also just replace everything in the Custom Footer module with the code below as well.
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
  
</xsl:template>
</xsl:stylesheet>

 
6.  Paste the modified Google Adsense code between the <template> tags, like the example below.
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<script type="text/javascript">
<![CDATA[<!--
google_ad_client = "pub-4773491283295080";
/* 160x600, created 4/1/08 */
google_ad_slot = "0237614524";
google_ad_width = 160;
google_ad_height = 600;
//-->]]>
</script>
<script type="text/javascript"
src="
http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</xsl:template>
</xsl:stylesheet>

Resources

Updated April 02, 2009



Links

Google Adsense

 



Search Website