Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Apache module for inserting AdSense code

insert javascript below <body> at virtual host level

7:23 am on Dec 23, 2003 (gmt 0)

New User

joined:Feb 10, 2005
votes: 0

Got a Google AdSense account (just a few lines of javascript code) and want to place it on each and every html pages, some static and some dynamic.

Don't want to touch/change existing web applications.

Instead I want to have a simple Apache module that automatically does this -- insert the AdSense javascript code right after the <BODY> tag for each and every html access -- at run time.

mod_layout (http://software.tangent.org/faqs/mod_layout.html#_1_3) has more than what I need. Too complicated.

mod_mocrify (http://mocrify.netandweb.de/) is also too much.

For performance and maintenance reasons, I want an extremely simple and neat module just for this simple task. The module is better not to have any file/disk operation (except initialization). I want to hold the 100 bytes Google code in memory.

Any suggestion? Thanks.

7:13 pm on Dec 24, 2003 (gmt 0)

Administrator from CA 

WebmasterWorld Administrator bakedjake is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 8, 2003
votes: 61

Yes - use mod_layout. It's designed to do exactly what you want to do, and do it easily. :)

It's cake to setup. Really.

BTW - Welcome to WebmasterWorld!