<?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>Easy Day Media &#187; php</title>
	<atom:link href="http://www.easydaymedia.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.easydaymedia.com</link>
	<description>Poker Affiliate, Wordpress Coder</description>
	<lastBuildDate>Wed, 21 Oct 2009 02:37:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>GeoTargetting with Maxmind and PHP</title>
		<link>http://www.easydaymedia.com/php/geotargetting-with-maxmind-and-php/</link>
		<comments>http://www.easydaymedia.com/php/geotargetting-with-maxmind-and-php/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 13:03:16 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.easydaymedia.com/?p=16</guid>
		<description><![CDATA[GeoTargetting, or being able to tell the country/city/state of your visitor, is applicable to most verticles but, in the gambling industry, there are situations where it becomes especially key in improving conversions.  Some rooms do not accept US players, some rooms do.  By combining this useful script and the API from Maxmind, you [...]]]></description>
			<content:encoded><![CDATA[<p>GeoTargetting, or being able to tell the country/city/state of your visitor, is applicable to most verticles but, in the gambling industry, there are situations where it becomes especially key in improving conversions.  Some rooms do not accept US players, some rooms do.  By combining this useful script and the API from <a href="http://www.maxmind.com/app/geolitecountry">Maxmind</a>, you can create pages that not only convert better but also provide a more positive experience for your user.</p>
<p>I created this guide as an <em>easy</em> get started method for geotargetting with maxmind&#8217;s geolocation db.  In this example we will be using the API provided to avoid having to setup a database and for simplicity of use.</p>
<p><strong><em>Disclaimer: I say that this is &#8220;easy&#8221; but it may not be &#8220;simple&#8221;.  If you follow the step by step instructions you will be able to effectively use this script.</em></strong></p>
<h4>What You Will Need to Know BEFORE You Get Started</h4>
<ul>
<li>How to access your site via FTP</li>
<li>The ABSOLUTE PATH to your server &#8211; This is NOT www.whateverdomain.com, this looks like /home/public_html/mb/inc.  If you do not know this path, you can ask your hosting company or search their website for the phrase &#8220;What is the absolute path&#8221;</li>
</ul>
<h4>Getting the GeoTargetting Script Installed on Your Server</h4>
<p>Now that you have the above information, the next step is to install the script on your server.</p>
<ul>
<li><strong>Step 1 &#8211; Download</strong> the <strong><a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz">binary format</a></strong> from maxmind&#8217;s website.</li>
<li><strong>Step 2 &#8211; Uncompress</strong> the file using gzip, winrar, or whatever program you use to unzip files.</li>
<li><strong>Step 3 &#8211; Download and uncompress</strong> <strong><a href="http://www.easydaymedia.com/wp-content/uploads/2009/10/easydaygeo.zip">EasyDayGeo.zip</a></strong>.  There are two files in this package, geoip.inc and geo.php.  The first file contains the class necessary to access the API, the second file contains the calls to the API.  In this case, we will just want the two letter name of the country that the visitor is from (US, etc).</li>
<li><strong>Step 4 &#8211; Create</strong> a directory named &#8220;<em><strong>inc</strong></em>&#8221; in the root folder of your website.  You should be able to access this folder by going to www.whateverdomain.com/inc/.</li>
<li><strong>Step 5 &#8211; Open geo.php</strong> and change &#8216;YOUR/PATH/TO/inc/GeoIP.dat&#8217; to reflect the actual path of &#8220;<strong><em>inc</em></strong>&#8221; folder you just created on the server.  Once again, this should look something like /home/public_html/mb/inc/GeoIP.dat when it&#8217;s done.</li>
<li><strong>Step 6 &#8211; Upload</strong> the three files: <strong>GeoIP.dat</strong>, <strong>geoip.inc</strong>, and <strong>geo.php</strong> to the <strong>&#8220;inc&#8221;</strong> folder.</li>
<p>The script is now installed on your server.  In this final section, you will call the script and use it as you see fit.</p>
<h4>Using the GeoTargetting Script</h4>
<p>Now that the script is installed on your server, you need to use it to determine the visitor&#8217;s country.  Since there are literally thousands of possible combinations available, I will just stick to the simplest one that pertains to the gambling industry.  <strong>Is my visitor from the US?</strong>  If so, I want to show them US only content.  If not, I want to show them other content.</p>
<p>At the top of your page, in the head section, add the following code:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YOUR/PATH/TO/inc/geoip.inc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$country</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Remembering, of course, that you need to change the path to reflect your ABSOLUTE path.  Next, wherever you want to geotarget content, add the following snippet.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$country</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'US'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
/// US CONTENT GOES HERE<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
/// NON-US CONTENT GOES HERE<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<h4>That&#8217;s It</h4>
<p>A few points to note.  For SEO purposes, google only crawls with US IP addresses, so any content you geotarget away from US visitors will not be crawled by googlebot.  Also, AOL visitors (I guess a small % still use AOL) will show as US visitors regardless of what country they are visiting from.  This has to do with the location of the AOL servers.</p>
<p>Feel free to comment with suggestions or better yet, post a link to where you are using this script so other&#8217;s can see it in action.</p>
<p><em>Coming soon, the re-release of the wordpress geotargetting plugin.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.easydaymedia.com/php/geotargetting-with-maxmind-and-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
