Using php to check location of user for ad switching?
I've got a little php script setup to randomly switch between three ads. One of these ads is global but the other two are for amazon.com and amazon.co.uk and I was thinking it might be better to ensure that amazon.co.uk only gets shown to visitors from the UK. Is this a doable check in php? What I have right now is this:
I'd imagine the first step would be to randomize the selection between AD 1 and AD 2 + AD 3. And if it hits AD 2 + AD 3, make a selection based on location.
'AD 1 - Global'
'AD 2 - Amazon.com - Should be Global except UK'
'AD 3 - Amazon.co.uk - Should be UK only'
srand ((double) microtime() * 9999999);
$random_number = rand(0,count($ad)-1);