1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

geotargetting

Discussion in 'Black Hat SEO' started by CSalt2, Dec 16, 2009.

  1. CSalt2

    CSalt2 Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 5, 2009
    Messages:
    753
    Likes Received:
    357
    Hey i need a way to geotarget by state, is there any service out there I can use that'll help me redirect my links based on the state location of the traffic?


    I was thinking of using this service but i dont know if its any good or if theres better alternatives
    http:// www adserversolutions com/geo-targeting.html
     
  2. angelas111

    angelas111 Jr. VIP Jr. VIP Premium Member

    Joined:
    Jan 4, 2009
    Messages:
    1,570
    Likes Received:
    1,016
    Location:
    ohio
    what are you trying to geo-target? your ads?
     
  3. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
    I use a lookup of the IP from this URL:

    Code:
    http://www.geoplugin.net/php.gp?ip=x.x.x.x
    
    That should return you a decent guess at a state / city - I use it as, for a change, it guesses UK place quite well (well, until recently anyway)
     
    • Thanks Thanks x 2
  4. xr4ti

    xr4ti Registered Member

    Joined:
    May 27, 2009
    Messages:
    72
    Likes Received:
    9

    this works great for geo targeting!

    and other related search food.

    geo targeting ads

    geo targeting ip

    geo targeting ppc

    adwords geo targeting

    google geo targeting

    geo targeting

    geo targeting ip address

    http://www.geoplugin.com/examples

    worked perfect for what i needed. thanks fatboy
     
    Last edited: Dec 16, 2009
  5. CSalt2

    CSalt2 Jr. VIP Jr. VIP Premium Member

    Joined:
    Feb 5, 2009
    Messages:
    753
    Likes Received:
    357
    hey fatboy thats a great plugin!

    I guess i should of mentioned what i'm trying to do here is redirect visitors from one state to one website and visitors from the rest of US/world to another website.

    Anybody know of anything for geo redirection?
     
  6. oxonbeef

    oxonbeef BANNED BANNED

    Joined:
    Jan 4, 2009
    Messages:
    2,242
    Likes Received:
    7,872
    I moved back to London from Belfast last week and I haven't deleted cookies on
    my laptop and my search results still are showing up for Belfast which I thought
    was really strange as I thought google would give results by ip and not cookies.
    If I enter local plumber into google I get results for Belfast.
     
    Last edited: Dec 16, 2009
  7. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
    Code:
    <?php
    	if ($_SERVER["HTTP_X_FORWARDED"]) 
    	{
    		$ip = $_SERVER["HTTP_X_FORWARDED"];
    	} 
    	elseif ($_SERVER["HTTP_FORWARDED_FOR"]) 
    	{
    		$ip = $_SERVER["HTTP_FORWARDED_FOR"];
    	} 
    	elseif ($_SERVER["HTTP_FORWARDED"]) 
    	{
    		$ip = $_SERVER["HTTP_FORWARDED"];
    	} 
    	elseif ($_SERVER["HTTP_X_FORWARDED"]) 
    	{
    		$ip = $_SERVER["HTTP_X_FORWARDED"];
    	} 
    		else 
    	{
    		$ip = $_SERVER["REMOTE_ADDR"];
    	}
    						
    	$geo = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
    	$city = $geo['geoplugin_city'];
    
            switch($city)
            {
                  case "Dallas":       <redirect to your targetted city page>;
                                           break;
    
                  default:               <redirect everyone else to this page>;
                                           break;
             }
    ?>
    
    Something like that should give you a good start.
     
    • Thanks Thanks x 1
  8. xr4ti

    xr4ti Registered Member

    Joined:
    May 27, 2009
    Messages:
    72
    Likes Received:
    9
    Code:
    <%
    
    
    Dim UserIPAddress
    UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    If UserIPAddress = "" Then
      UserIPAddress = Request.ServerVariables("REMOTE_ADDR")
    End If
    
    
    Response.write("your ip: "&UserIPAddress&"<br />")
    
    
    Set objGetData = Server.CreateObject("Microsoft.XMLHTTP" )
    objGetData.Open "GET" , "http://www.geoplugin.net/asp.gp?ip="&UserIPAddress, FALSE
    objGetData.sEnd
    TheData =  objGetData.Responsetext
    Set objGetData = Nothing
    
    iCity=InStr(TheData,"@0")
    iCityEnd= InStr(TheData,"@1") - iCity
    strCity=Mid(TheData,iCity+3,iCityEnd-4)
    
    response.write("<br />city: "&strCity)
    
    
    iRegion=InStr(TheData,"@2")
    iRegionEnd= InStr(TheData,"@3") - iRegion
    strRegion=Mid(TheData,iRegion+3,iRegionEnd-4)
    
    response.write("<br />region: "&strRegion)
    
    iAreaCode=InStr(TheData,"@4")
    iAreaCodeEnd= InStr(TheData,"@5") - iAreaCode
    strAreaCode=Mid(TheData,iAreaCode+3,iAreaCodeEnd-4)
    
    response.write("<br />area code: "&strAreaCode)
    
    iDmaCode=InStr(TheData,"@6")
    iDmaCodeEnd= InStr(TheData,"@7") - iDmaCode
    strDmaCode=Mid(TheData,iDmaCode+3,iDmaCodeEnd-4)
    
    response.write("<br />dma code: "&strDmaCode)
    
    iCountryCode=InStr(TheData,"@8")
    iCountryCodeEnd= InStr(TheData,"@9") - iCountryCode
    strCountryCode=Mid(TheData,iCountryCode+3,iCountryCodeEnd-4)
    
    response.write("<br />country code: "&strCountryCode)
    
    
    icountryName=InStr(TheData,"@10")
    icountryNameEnd= InStr(TheData,"@11") - icountryName
    strcountryName=Mid(TheData,icountryName+4,icountryNameEnd-5)
    
    response.write("<br />country name: "&strcountryName)
    
    icontinentCode=InStr(TheData,"@12")
    icontinentCodeEnd= InStr(TheData,"@13") - icontinentCode
    strcontinentCode=Mid(TheData,icontinentCode+4,icontinentCodeEnd-5)
    
    response.write("<br />continent code: "&strcontinentCode)
    
    ilatitude=InStr(TheData,"@14")
    ilatitudeEnd= InStr(TheData,"@15") - ilatitude
    strlatitude=Mid(TheData,ilatitude+4,ilatitudeEnd-5)
    
    response.write("<br />lat: "&strlatitude)
    
    ilongitude=InStr(TheData,"@16")
    ilongitudeEnd= InStr(TheData,"@17") - ilongitude
    strlongitude=Mid(TheData,ilongitude+4,ilongitudeEnd-5)
    
    response.write("<br />long: "&strlongitude)
    
    
    icurrencyCode=InStr(TheData,"@18")
    icurrencyCodeEnd= InStr(TheData,"@19") - icurrencyCode
    strcurrencyCode=Mid(TheData,icurrencyCode+4,icurrencyCodeEnd-5)
    
    response.write("<br />currency code: "&strcurrencyCode)
    
    icurrencySymbol=InStr(TheData,"@20")
    icurrencySymbolEnd= InStr(TheData,"@21") - icurrencySymbol
    strcurrencySymbol=Mid(TheData,icurrencySymbol+4,icurrencySymbolEnd-5)
    
    response.write("<br />currency symbol: "&strcurrencySymbol)
    
    icurrencyConverter=InStr(TheData,"@22")
    icurrencyConverterEnd= InStr(TheData,"@23") - icurrencyConverter
    strcurrencyConverter=Mid(TheData,icurrencyConverter+4,icurrencyConverterEnd-5)
    
    response.write("<br />currency converter: "&strcurrencyConverter)
    
    'if state is CA THEN REDIRECT TO ANOTHER PAGE. 
    
    If strRegion = "CA" then
    
    	response.redirect("http://www.sitejustforonestate.com")
    
    Else
    	response.redirect("http://www.somewhere.com")
    End if
    
    %>
    this is what i'm using in .asp if anyone needs that.
     
  9. michelle111

    michelle111 Registered Member

    Joined:
    Jun 3, 2011
    Messages:
    61
    Likes Received:
    20
    Thanks for the PHP code it works great but what i am trying to do is redirect by region or city
    i can get it to work for one or the other but not both at the same time

    eg. if visitor is in region "victoria" - go to website1
    if visitor is in city "sydney" - go to website1 (city is in a different region)

    else go to website2

    can this be done?
     
  10. Kiopa_Matt

    Kiopa_Matt Registered Member

    Joined:
    Jun 3, 2011
    Messages:
    99
    Likes Received:
    11
    Google Maxmind, and they offer an excellent API.