homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & jatar k & martinibuster

Google AdSense Forum

A banner rotator for Adsense and another Ad?
Script for bannor rotator compatible with Adsense

 9:36 pm on Jun 1, 2005 (gmt 0)

I have searched for this everywhere and for ages now but cant find one.

Basically what I'm looking for is a script that allows Google Adsense and another Ad like Clicksor etc. to be rotated.

Since my site is in normal html it cant be php or other. So I'm looking for something along the lines of in javascript and looks up a txt file and rotates the ads accordingly.

Is this possible, I mean it should be, but cant find anything suited for my purpose.



 10:26 pm on Jun 1, 2005 (gmt 0)

i know this isn't exactly what you are looking for, but i am suggesting it in case you didn't know about it... you could use google's "alternate url" to show alternative ads whenever there aren't google ads to display:



 11:31 pm on Jun 1, 2005 (gmt 0)

Try searching for phpadsnew.

It's all good!


 11:35 pm on Jun 1, 2005 (gmt 0)

Is it not against the TOS?


 11:46 pm on Jun 1, 2005 (gmt 0)

as long as you dont modify the adsense code, its not against TOS. but php ads new wont help him. he wants a javascript.

im kind of interested if he finds anything. my front page is plain html to cut down on server load.


 11:50 pm on Jun 1, 2005 (gmt 0)

This doesn't sound like it would be terribly hard to make in JavaScript. You'd have all code assigned to an array of variables, then randomly (or whatever weight you'd want to build in) pick which to display, and then do a document.write() of the selected ad where appropriate. Sounds like it could be done in less than 15-20 lines of JS.


 12:18 am on Jun 2, 2005 (gmt 0)

Yeah... just because I wanted to see just how simple the JS would be... here you go. Was less than 20 lines (mostly just the ad code:


I've removed my own ID's from the code (look for X's and Z's). Feel free to swipe the code and use where you will. The only thing I had to do was condense the Google Ad Code down to one line. This is technically in violation of TOS, although, I'm sure you can get JavaScript to output it the proper way with some newlines put in there..


[edited by: Jenstar at 4:02 pm (utc) on June 2, 2005]
[edit reason] No URLs as per TOS [/edit]


 12:19 am on Jun 2, 2005 (gmt 0)

Oh yeah... hit reload of a few times to see the random rotation.


 12:23 am on Jun 2, 2005 (gmt 0)

sweet, thanks diverman.


 12:46 am on Jun 2, 2005 (gmt 0)

No problem. glad to help. I'd actually been wondering about doing something like this myself for other things, although I'd likely do it in PHP or some other language with a DB backend, and weighted rotation. I'm sure you probably could find another implementation that may be more robust that what I whipped up in a few seconds. Try a google search or something to see if you can find more. :)


 9:53 am on Jun 2, 2005 (gmt 0)

Ok thanks alot everyone for your input. As far as I know its not in the TOS so it should be ok. Its funny how your not allowed to put a competitors ad in as an alternative ad but nothing about a rotator of some sort.

Anyway I'll give the script a go and I'll post the results. Thanks again diverman.


 1:20 pm on Jun 2, 2005 (gmt 0)

Very slick. I am having fun with it.

Thanks a bunch.


 2:38 pm on Jun 2, 2005 (gmt 0)

long time since I had an adsense account but from memory adbutler(do a google search) was able to rotate a wide variety of banner types and I think As was one of them.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Google / Google AdSense
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved