1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Geotargetting Question

Discussion in 'Programming' started by T0PS3O, Oct 22, 2004.

  1. #1
    I need to geotarget AdSense ads.

    However, the page is static html. It won't even do virtual includes.

    So I was wondering, knowing slim to none about javascript, whether it would be possible with some javascript. Perhaps by including some img from a dynamic page which on it's turn finds out the visitor's location and alters the img accordingly. Then according to which img is returned, the javascript outputs the ads or not.

    Is this possible?

    Our visitor tracking works like this with a javascript img pulled from the tracking server. By just that they know nearly everything about the visitor so I was hoping to port that back to my site and show relevant ads if the visitor is from the USA. (We only ship UK but rank well world wide so want to monetize on the traffic.) I have an IP database already and this idea works just fine on my PHP pages.

    So... Is this possible?

    ( :) if yes, then I'll ask how later... )

    Gracias in advance.
    SEMrush
     
    T0PS3O, Oct 22, 2004 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,285
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    First you are going to need a geotargetting database to determine the location based on IP. The easiest way (for me anyway) would be to have a PHP script serve up your images. Having that PHP script query your database to determine the country first.
     
    digitalpoint, Oct 22, 2004 IP
  3. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,220
    Likes Received:
    778
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have the database and have such a script working successfully on a .php page.

    The basic idea is to show ads if a visitor isn't from the UK and it works fine on the dynamic pages.

    This one I want it on now as well is plain dead static html. So yes I can create a file which queries the database but...

    1) How do I get the visitor's IP from the html page to the php script and...
    2) How do I get the decision from my PHP page (as to whether or not displaying ads) back to the html page and subsequently displaying it.

    Javascript, in my imagination, is the only possible way but I don't know if it can be done.

    The tracking system just works one way - pull an img from their server and they know all stat because the visitors pulls it straight from their server. But htis requires a two-way operation.

    Any ideas?
     
    T0PS3O, Oct 22, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,285
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Use the image functions in PHP to spit out the image. That way all you have to do is use a normal IMG tag (doesn't matter if the page is static or dynamic). Within PHP you can see the IP address of the person making the request for the image file.
     
    digitalpoint, Oct 22, 2004 IP
  5. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,220
    Likes Received:
    778
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yeah the PHP part of it isn't the problem.

    I'll mess around with it over the weekend if I get the time.
    i don't want to show the actual img though, just use it as a way to transfer data, let javascript evaluate it and then decide on outputting AdSense code or not. So no img will be shown.

    I'll try it out. Thanks for helping (I'm bound to get back here though).
     
    T0PS3O, Oct 22, 2004 IP
  6. vlead

    vlead Peon

    Messages:
    215
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Where can we get this database from?
     
    vlead, Oct 22, 2004 IP
  7. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,285
    Likes Received:
    2,600
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #7
    Search Google for geotargetting database, I'm sure you will get lots of places that sell them (in natural results and AdWord advertisers).
     
    digitalpoint, Oct 22, 2004 IP
  8. iconv

    iconv Well-Known Member

    Messages:
    190
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #8
    iconv, Oct 22, 2004 IP