![]() |
Geo Targeting to one specific merchant.
Hi Eric and Team,
I have this code to redirect people to a certain page based on their Geographical location. The trouble is, I'm not sure how to use it. Only one of my merchants ships outside of the US, so I want to setup a page with only this merchants products and use the code below to have international users open to this page as opposed to how it opens now, with all my merchants. I need to know where to post the code to and do I make a new page or category for this one merchant. Any help would be great. Here is the link to my site: http://allamericansneakers.com Here is the code, it will need to be modified, but I think I can handle that. <?php $server = ''; // MySQL hostname $username = ''; // MySQL username $password = ''; // MySQL password $dbname = ''; // MySQL db name $db = mysql_connect($server, $username, $password) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $sql = 'SELECT country FROM ip2nation WHERE ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'") ORDER BY ip DESC LIMIT 0,1'; list($country) = mysql_fetch_row(mysql_query($sql)); switch ($country) { case 'se': // Get the Swedish to a Swedish newssite header('Location: http://www.thelocal.se/'); exit; case 'us': // And redirect US visitors to CNN header('Location: http://www.cnn.com/'); exit; default: // The rest of the world can go to BBC header('Location: http://www.bbc.co.uk/'); exit; } ?> |
I think you will probably need to write your own WP Plugin to handle this. This is outside the scope of Datafeedr.
|
Maybe this (paid) GEO targeting WordPress plugin may help...
http://thewordpress.net/plugins/geotargeting/ It allows you to redirect visitors from a certain country to any URL |
Thanks so much Stefan. I'll try it and let you know.
|
All times are GMT -5. The time now is 01:13 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.