Welcome to WebmasterWorld Guest from 54.160.254.203

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

A banner rotator for Adsense and another Ad?

Script for bannor rotator compatible with Adsense

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

New User

10+ Year Member

joined:June 1, 2005
posts:2
votes: 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 June 1, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 14, 2005
posts:644
votes: 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:

[google.com...]

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

Preferred Member

10+ Year Member

joined:Feb 24, 2004
posts:639
votes: 0


Try searching for phpadsnew.

It's all good!

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

Junior Member

10+ Year Member

joined:Nov 17, 2004
posts:195
votes: 0


Is it not against the TOS?
11:46 pm on June 1, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 16, 2005
posts:74
votes: 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 June 1, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:May 11, 2005
posts:55
votes: 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 June 2, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:May 11, 2005
posts:55
votes: 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:

<snip>

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..

-Alex

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

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

Junior Member

10+ Year Member

joined:May 11, 2005
posts:55
votes: 0


Oh yeah... hit reload of a few times to see the random rotation.
12:23 am on June 2, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 16, 2005
posts:74
votes: 0


sweet, thanks diverman.
12:46 am on June 2, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:May 11, 2005
posts:55
votes: 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 June 2, 2005 (gmt 0)

New User

10+ Year Member

joined:June 1, 2005
posts:2
votes: 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 June 2, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 23, 2004
posts:891
votes: 5


Very slick. I am having fun with it.

Thanks a bunch.

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

Preferred Member

10+ Year Member

joined:Apr 10, 2004
posts:568
votes: 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.