homepage Welcome to WebmasterWorld Guest from 54.237.95.6
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & jatar k & martinibuster

Google AdSense Forum

    
Script to automatically change adsense on a site?
Script to automatically change adsense on a site?
luckystrike




msg:4078771
 1:49 am on Feb 12, 2010 (gmt 0)

as a webmaster who uses adsense is there some script which i could use to automatically change adsense on a site or make one advert with one theme appearing one time, and another advert based on a different colour themes appearing next?

this would allow:

- me to use different banners on same banner space
- allow me to easily change adsense banners in future

 

Lame_Wolf




msg:4078774
 2:07 am on Feb 12, 2010 (gmt 0)

[adsense.blogspot.com...]

It is kind of the thing you want.

netmeg




msg:4078780
 2:28 am on Feb 12, 2010 (gmt 0)

I've got a PHP script I use, if you can use PHP.

luckystrike




msg:4078812
 3:47 am on Feb 12, 2010 (gmt 0)

hi netmeg - thank you how do i get hold of that?

[edited by: incrediBILL at 4:53 am (utc) on Feb 12, 2010]
[edit reason] no email addresses please [/edit]

netmeg




msg:4079065
 3:03 pm on Feb 12, 2010 (gmt 0)

The way I do it - I put each bit of AdSense code in a separate file - red.php, blue.php and green.php (if I want to rotate the colors, for example) and I stick them in a directory called ads.

The I make a script like this:

<?
$x = rand(1,3);
switch($x) {

case 1:
include $_SERVER['DOCUMENT_ROOT']."/ads/blue.php";
break;

case 2:
include $_SERVER['DOCUMENT_ROOT']."/ads/red.php";
break;

case 3:
include $_SERVER['DOCUMENT_ROOT']."/ads/green.php";
break;

}
?>

And I name the script, say, random468.php (so I can tell what type of ads are in there)

Then I include it in the page in the spot I want the ads to show:

<? include $_SERVER['DOCUMENT_ROOT']."/random468.php" ?>

And the ads will rotate evenly. If I decide I don't like blue one, I change the one line to be $x = rand(2,3); so it will just rotate between red and green.

Adapt to suit.

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved