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.

Why I love geotargetting

Discussion in 'General Marketing' started by SERPalert, May 5, 2005.

  1. #1
    Ok first I'm reasonably new to php. So there might be better ways of doing this.

    Geo targetting can be very cool. I'm in the UK, and only people in the UK would ever buy my products/services. Therefore all other visitors are useless to me.

    So I do one of two things depends on the site.

    IF they're outside the UK I might display big adsense banners at the top of every page.

    Or I might forward them onto a USA site (in exchange for the USA site sending their UK visitors back to me)

    
    <?
    # Geotargetting script by TFMG on digitalpoint forums http://forums.digitalpoint.com
    
    if(!($ip = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']))
    $ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
    $agent = $_SERVER['HTTP_USER_AGENT'];
    $location = file_get_contents("http://www.hostip.info/api/get.html?ip=$ip");
    
    if (!eregi('googlebot', $agent) || !eregi('msnbot', $agent) || !eregi('slurp', $agent)) {
    
    if (!eregi('UNITED KINGDOM', $location)) {
    
    // do something
    
    // like display google adsense
    
    // or send the user to a USA partner website....
    
    }
    }
    
    ?>
    Code (markup):
    Let me break the above down to make it easier for people.

    The first two lines get the IP address of the visitor.
    The third line gets the users USERAGENT. This helps determine if the visitor is a human or a robot, and what browser they're using etc.

    This statement says. If the person visiting is not googlebot, msnbot or yahoobot then excute the contents of the braces {}

    (If it's a search engine we don't want to mess around with what they see...)

    Finally

    If they're NOT from the United Kingdom then execute the contents of the braces {}.

    Now, the contents of the braces could be....

    1. A meta refresh to another site in the visitors geographic area

    OR

    2. Some banners/adsense etc.

    I really hope this helps. I've got loads of other neat little scripts....and depending on the response to this I'll take the time to get them posted.

    Feedback appreciated.
     
    SERPalert, May 5, 2005 IP
    SHT, T0PS3O, dct and 2 others like this.
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Exactly what I do as well. Due to great international ranking I get 'useless' traffic. Am indeed plastering AdSense on their screens or serving US/Other related affiliate links instead to monetize on the traffic.

    I use a database though instead of a 3d party lookup.

    To take it easy on the database requests I have a bit of code that checks the referer. It basically only checks their IP if the referer is g.com or other .com/non-UK SE. If so then it will do the geotargeting. If referer is OK then just assume UK visitor without the IP checks.

    Good post, I might rate it ;)
     
    T0PS3O, May 5, 2005 IP
  3. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Someone as clever as me! :)

    I thought about that, but are databases not expensive?

    Surely a US visitor could come to your site from a UK click through....? Therefore you could miss out? Or did I miss something?
    WOO!
     
    SERPalert, May 5, 2005 IP
  4. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Oh one last thing,

    If you

    Somewhere in the script it will show you the country where you're visiting from....so if you need to tweak the script (you might not be in the UK) then that might help you.

    And if you decide to use the script pm me and give me a link to one of my sites, please. I wont cry if you don't but I could do with a couple of links :)
     
    SERPalert, May 5, 2005 IP
  5. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks to those people that did pm me :)
     
    SERPalert, May 9, 2005 IP
  6. blackbug

    blackbug Peon

    Messages:
    1,002
    Likes Received:
    89
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Fantastic. I've been wondering about that for a while. One of our shops only ships to the UK (at the suppliers request).

    I was working out how to send the visitor to a stockist in their own country (via an affiliate link, natch :)). This'll do the trick nicely.

    Of course, I won't just redirect them away automatically. Someone abroad might be buying a gift for someone in the UK. Plus, on my old ISP (NDO) I was often accused of being in the states by some site's geotargetting... and skynews wouldn't let me in! Gah!


    Cheers again TFMG.

    Chris
     
    blackbug, May 9, 2005 IP
  7. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #7
    For my own purposes I have written a little addition. It tells the user they're being directed in 10 seconds and they have the choice not to, if they decide not too then I've set a cookie, so in future they don't get hassled out :)
     
    SERPalert, May 9, 2005 IP
  8. blackbug

    blackbug Peon

    Messages:
    1,002
    Likes Received:
    89
    Best Answers:
    0
    Trophy Points:
    0
    #8
    :) Yeah, good idea. I think I'll just add a strapline at the top of each page that is "switched on" by geotargeting. This can then directing them to an international page to choose at will. (or they can shut it up with a cookie if they want).


    Cheers

    Chris
     
    blackbug, May 9, 2005 IP
  9. bresso

    bresso Berserker

    Messages:
    112
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thank you very much for this neat script! Users that actually buy things on my sites are people whose mother tongue is English. How would could your script redirect people not from ie. England, USA, Ireland, NZ, ... ? I doubt simply adding the country name will do the trick.. ;) Thank you.
     
    bresso, May 9, 2005 IP
  10. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #10
    First let me understand the question.

    So you want to redirect all english speaking countries to one place, then everyone else to another?
     
    SERPalert, May 9, 2005 IP
  11. DangerMouse

    DangerMouse Peon

    Messages:
    275
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I think this may be considered as cloaking your content... Having had my site banned by the big G for trying to do something similar - with best intentions at heart ;) - I wouldn't recommend it
     
    DangerMouse, May 9, 2005 IP
  12. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #12
    You are correct. However all the big sites do it, hell even google do it (I'm in the uk, if I goto www.google.com it redirects to google.co.uk)

    And if you look at the script IF it's a bot it doesn't do anything....
     
    SERPalert, May 9, 2005 IP
  13. DangerMouse

    DangerMouse Peon

    Messages:
    275
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #13
    That assumes that the robots will always identify themselves - they don't! (exactly for that reason ;))
     
    DangerMouse, May 9, 2005 IP
  14. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I'd disagree, do you have any evidence?
     
    SERPalert, May 9, 2005 IP
  15. DangerMouse

    DangerMouse Peon

    Messages:
    275
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Not personally... But my site's banned and I'm pretty sure that's why.

    I think it's why the "cloakers" use IP based content delivery scripts though... Because the user agent is so easy to fake/change.
     
    DangerMouse, May 9, 2005 IP
  16. dirtdog1960theone

    dirtdog1960theone Active Member

    Messages:
    124
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #16
    Hi is this the line that identifies the user's ip address to the country?

     
    dirtdog1960theone, May 9, 2005 IP
  17. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Yes sir, try printing it to see exactly what it does.
     
    SERPalert, May 9, 2005 IP
  18. jbw

    jbw Peon

    Messages:
    343
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #18
    hostip.info seems to have a pretty bad geotargeting system, everytime I visit it I am somewhere else according to it!
     
    jbw, May 14, 2005 IP
  19. SERPalert

    SERPalert Guest

    Messages:
    1,003
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Country it's perfect, IMO. City it is not, and never will be. Read the site...They rely on user input...
     
    SERPalert, May 16, 2005 IP
  20. jbw

    jbw Peon

    Messages:
    343
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #20
    yes, I did, it uses many of the same methods I have tried. And even country it is much less accurate then it should be, it does not use the full ripe splits for example if you read the code they used to start the db.
     
    jbw, May 16, 2005 IP