[PHP] Don't count own impressions and have same site layout

Discussion in 'AdSense' started by yonghoshin, Aug 12, 2008.

  1. #1
    I've been trying to find a way to not allow AdSense to count my own impressions (can this increase the chance of smart pricing?) without disabling Javascript, because I need JS to view other websites.

    All I did was insert some PHP code to check the visitor's IP. If the IP is mine, then instead of showing AdSense, I show a white block.

    
    function adsense() {
      if ($_SERVER['REMOTE_ADDR'] != "-your ip-") {
        // show adsense
      } 
      else {
        // show white block
      }
    }
    
    PHP:
    This allows me to:

    1) Keep Javascript on
    2) Not count my own impressions in AdSense
    3) Show AdSense like normal to my visitors
    4) Retain site layout of having AdSense shown
     
    yonghoshin, Aug 12, 2008 IP
  2. devgank

    devgank Peon

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Interesting.

    I think I will use this on my site, I did something similar with my zango gateway but didnt think about it for adsense so I can get better stats.
     
    devgank, Aug 12, 2008 IP
  3. informationHell

    informationHell Peon

    Messages:
    931
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nice and simple way... thanks
     
    informationHell, Aug 13, 2008 IP
  4. shrkscn

    shrkscn Peon

    Messages:
    1,157
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Nice information.... this will help if you are doing a lot of testing on your site..
     
    shrkscn, Aug 14, 2008 IP