Anyone know the coding or script I can use to alternate adsense ID's?

Discussion in 'HTML & Website Design' started by kevinn, Aug 11, 2006.

  1. #1
    Hello, noobie here, was wondering if anyone knows the coding or script to alternate adsense ID's on a website for my partner and I. For example, 1 week it would be my pub ID and one week it would be his.

    Thanks!
     
    kevinn, Aug 11, 2006 IP
  2. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you use PHP on your host?

    <?php
    $which_ad = rand (0, 1); // Generates random integer, 0 or 1
    	if ($which_ad == 0) { // Kevin's awesome ad
    
    ?>
    HTML FOR AD HERE
    <?php
    	}
    	else { // Other person's ad
    ?>
    
    HTML FOR AD HERE
    <?php
    	}
    ?>
    
    PHP:
    If the ads are the same (just different ID's), you could store the ID as a variable and echo it. Also, if you end up with a lot of people on your team, you can just use a switch statement.
     
    Gordaen, Aug 11, 2006 IP
  3. kevinn

    kevinn Active Member

    Messages:
    1,337
    Likes Received:
    84
    Best Answers:
    0
    Trophy Points:
    90
    #3
    thanks! :)
     
    kevinn, Aug 11, 2006 IP