<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sequential Logic &#187; GeoIP</title>
	<atom:link href="http://www.sequentiallogic.com/category/geoip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sequentiallogic.com</link>
	<description>Where software engineering meets online marketing</description>
	<lastBuildDate>Thu, 04 Mar 2010 21:03:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple non-U.S. visitor redirect for your affiliate landing pages</title>
		<link>http://www.sequentiallogic.com/2009/08/22/simple-non-u-s-visitor-redirect-for-your-affiliate-landing-pages/</link>
		<comments>http://www.sequentiallogic.com/2009/08/22/simple-non-u-s-visitor-redirect-for-your-affiliate-landing-pages/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 03:51:27 +0000</pubDate>
		<dc:creator>emile</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[GeoIP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.sequentiallogic.com/?p=156</guid>
		<description><![CDATA[Even with proper geo-targeting set up for your campaigns, search engines and ad networks will sometimes send you traffic from countries you did not request. In that case, it's probably better for you to redirect them to an appropriate offer that takes traffic from their country. If you let the affiliate network do the redirecting, [...]]]></description>
			<content:encoded><![CDATA[<p>Even with proper geo-targeting set up for your campaigns, search engines and ad networks will sometimes send you traffic from countries you did not request. In that case, it's probably better for you to redirect them to an appropriate offer that takes traffic from their country. If you let the affiliate network do the redirecting, you run the risk of the visitor getting redirected to Webfetti, or some other offer unrelated to the visitor's initial click.</p>
<p>I have a basic non-U.S. visitor redirect system in place.</p>
<p>First, you need to get GeoIP set up on your server, which I detail in my post <a href="/2009/05/29/maxmind-geolite-country-and-geolite-city-made-easy/">MaxMind GeoLite Country and GeoLite City Made Easy</a></p>
<p>Once that is set up and running properly, follow these 2 steps:</p>
<p>1) Download my <a href="/wp-content/uploads/2009/08/GeoIPFunctions.phps">GeoIPFunctions.php</a> file and put it in your GeoIP folder on your server.</p>
<p>Be sure to change the parameter on line 6 to match your server setup.</p>
<p>2) At the top of your PHP landing page, put this code:</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'/PATH/TO/YOUR/GEOIP/FILES/GeoIPFunctions.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RedirectNonUS<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'URL of your Non U.S. affiliate offer'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Again, make sure the path in the require_once matches the path to your GeoIP files.</p>
<p>Now when non U.S. based visitors come to your landing page, you can send them to another offer that accepts non U.S. traffic.</p>
<p>This system is very simplistic, and a setup that forwards any individual country's visitors on to a specific URL would be a better solution, but I'll leave that for later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sequentiallogic.com/2009/08/22/simple-non-u-s-visitor-redirect-for-your-affiliate-landing-pages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MaxMind GeoLite Country and GeoLite City Made Easy</title>
		<link>http://www.sequentiallogic.com/2009/05/29/maxmind-geolite-country-and-geolite-city-made-easy/</link>
		<comments>http://www.sequentiallogic.com/2009/05/29/maxmind-geolite-country-and-geolite-city-made-easy/#comments</comments>
		<pubDate>Fri, 29 May 2009 16:00:13 +0000</pubDate>
		<dc:creator>emile</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[GeoIP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.sequentiallogic.com/?p=105</guid>
		<description><![CDATA[Some consumers are up in arms because that fake blog they read by someone who just happens to be from the same city they live in, turns out to be a bit phony. They're surprised to find out that a piece of software is behind the trick, which does a GeoIP lookup on their IP [...]]]></description>
			<content:encoded><![CDATA[<p>Some consumers are up in arms because that fake blog they read by someone who just happens to be from the same city they live in, turns out to be a bit phony. They're surprised to find out that a piece of software is behind the trick, which does a GeoIP lookup on their IP address, and then uses that within the text of the splog, or ad, making the reader feel a bit more of a connection to the ad copy.</p>
<p>Even before these splogs popped up, I had been interested in GeoIP lookup techniques for Google Maps mashup purposes, but the splog trick finally made me figure out how it was done.</p>
<p>DISCLAIMER: I don't condone the use of these techniques for deceptive advertising techniques. At best, they are disingenuous, and at worst, may be illegal, according to the FTC. Like The Force, this technique can be used for good or evil. Which path you choose is up to you.</p>
<p><a href="http://www.maxmind.com/app/city">MaxMind has a paid GeoIP City database service</a> that costs $370 up front and $90 a month for database updates, which they advertise as 99.8% accurate in determining location from IP address. However, they also make a free database available, that is 99.5% accurate. We'll cover the free version since the accuracy difference is negligible for our purposes.</p>
<p>The crucial information is spread out over four pages on the MaxMind site:</p>
<p><a href="http://www.maxmind.com/app/api">APIs for GeoIP products</a><br />
<a href="http://www.maxmind.com/app/geolitecountry">GeoLite Country information</a><br />
<a href="http://www.maxmind.com/app/geolitecity">GeoLite City information</a><br />
and our API of choice, the <a href="http://www.maxmind.com/app/php">GeoIP PHP API</a></p>
<p>It should be noted that the GeoIP PHP API has three methods of being implemented, each being more efficient with webserver resources than the previous: a pure PHP module, a PECL module that allows you to embed the GeoIP C Library inside PHP, and mod_geoip, an Apache module that you can access via PHP. Since our needs are fairly minimal, we'll go with the easiest to implement, the pure PHP module, which requires no PHP or Apache changes.</p>
<p>1) <a href="http://geolite.maxmind.com/download/geoip/api/php/">Download the following PHP files from MaxMind</a>: geoipcity.inc, geoip.inc, and geoipregionvars.php .</p>
<p>2) <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz">Download the latest GeoLite City Binary Format file</a>, which is updated on the 1st of each month, and gunzip it.</p>
<p>3) Put all of those files in their own directory somewhere on your webserver, and for this example, we'll name the directory GeoIP.</p>
<p>4) Put the following code in a web-accessible PHP page, changing the PATH/TO parts to match your setup, and view the page in a web browser:</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require_once</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'/PATH/TO/GeoIP/geoipcity.inc'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$gi</span> = geoip_open<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'/PATH/TO/GeoIP/GeoLiteCity.dat'</span>, GEOIP_STANDARD<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$location</span> = GeoIP_record_by_addr<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$gi</span>, <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'REMOTE_ADDR'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">geoip_close<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$gi</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;pre&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color:#000066;">print_r</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$location</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;/pre&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">I believe you are in <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$location</span>-&gt;<span style="color:#006600;">city</span> <span style="color:#000000; font-weight:bold;">?&gt;</span>, <span style="color:#000000; font-weight:bold;">&lt;?php</span> <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$location</span>-&gt;<span style="color:#006600;">region</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The database says I'm in Los Angeles when in fact we're in Mission Viejo (Orange County), which isn't a huge deal, but shows the possible slight inaccuracy in IP->location lookup.</p>
<p>One thing this could benefit from is a quick state abbreviation to full state name conversion function, so the text would be "Los Angeles, California" instead of "Los Angeles, CA". I think the full spelling looks more natural in some instances. I've uploaded a <a href="/wp-content/uploads/2009/05/StateAbbreviationToStateName.phps">PHP state abbreviation to state name conversion function</a> for your use.</p>
<p>Update: <a href="http://dangerbrown.com/easy-geoip-script-to-be-sneaky-with/">Danger Brown steals the show for GeoIP made REALLY easy</a>. He's got a two line javascript snippet that does the same thing, but is reliant on the MaxMind servers each time the script is called. My experience with using javascript that is resident on outside servers is that it works great until it doesn't. One day your site will be slow or completely down because the outside javascript is failing to load. Some well crafted code can mitigate the risk, but I prefer to have all executing code on my server. Except for Google Analytics, because I tend to be no match for their servers.</p>
<p>Update 2: I've uploaded <a href="/wp-content/uploads/2009/05/geoipcity.inc">my modified geoipcity.inc</a> that includes the abbreviation to state/province function, with ON->Ontario included, and the call to that function in GeoIP_record_by_addr. Note that I could have also put the $record->region_name = Abbreviation_GetStateName($record->region); code within the _get_record function, but I chose to put it in the higher-level GeoIP_record_by_addr function.</p>
<p>Update 3: <a href="http://seocracy.com/2010/03/quick-and-painless-geo-location/">SEOcracy.com has a post about a very simple way to use the Google javascript API to do geolocation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sequentiallogic.com/2009/05/29/maxmind-geolite-country-and-geolite-city-made-easy/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>
