Hi
Anyone here can share country GEO redirect script for prosper202 please? Thanks alot
why use the GEO redirect script on facebook? your audiences are sure someone country.
I think this is what you're looking for!
Here you go man:
http://ipyxel.com/redirect-internati...geo-targeting/
<?PHP
require 'vendor/autoload.php';
$ipaddress = $_SERVER["REMOTE_ADDR"];
use \GeoIp2\Database\Reader;
$reader = new Reader('GeoLite2-City.mmdb');
$record = $reader->omni($ipaddress);
$subid = $_GET['subid'];
switch($record->country->isoCode) {
case 'GB':
$redirect = 'http://f5media.com/aff_offer.php?aff_id=325423&s1=sampleoffer&s2='.$subid;
header("Location:$redirect");
exit;
default:
$redirect = 'http://www.google.com'.$subid;
header("Location:$redirect");
exit;
}
?>
http://mydomain.com/tracking202/redirect/dl.php?t202id=129&t202kw=test
Is this Prosper202 or the STM mobile version? It may pay to learn how to do this independently of tracking systems - they say you master tracking, not a tracking system itself. Try the code below for example. Here you would link adverts to this php file and would pass the t202id/kw/c1/c2 etc values as normal and let it pass them through to the p202 link. You could alternatively hardcode t202ids into the file rather than passing dynamically. Make sure to test so you get an understanding of how the script works.
[PHP]
<?php
$t202id = $_GET['t202id'];
$t202kw = $_GET['t202kw'];
$c1 = $_GET['c1'];
$c2 = $_GET['c2'];
$c3 = $_GET['c3'];
$c4 = $_GET['c4'];
$c5 = $_GET['c5'];
$geoip = geoip_record_by_name( $_SERVER['REMOTE_ADDR'] );
$country_code = $geoip['country_code'];
//simple redirect
switch($country_code) {
case 'US'or'CA'or'GB':
header('Location: http://mydomain.com/tracking202/redirect/dl.php?t202id='.$t202id.'&t202kw='.$t202k2.'&c1='. $c1.'&c2='.$c2.'&c3='.$c3.'&c4='.$c4.'&c5='.$c5);
exit;
case 'DE'or'FR':
header('Location: http://mydomain.com/tracking202/redirect/dl.php?t202id=12345&t202kw='.$t202k2.'&c1='.$c1.'& c2='.$c2.'&c3='.$c3.'&c4='.$c4.'&c5='.$c5);
exit;
default: // exceptions
header('Location: http://otherurl.com/');
exit;
}
?>
[/PHP]
Upload file to your server somewhere. Load that file but with querystrings, i.e. myredirect.php?t202id=12345&t202kw=yaytestingstuff . Use a real t202id or obviously it will fail.
@zeno Thank for the code but seem it has something wrong on my side. This is exactly what i did
<?php
$t202id = $_GET['t202id'];
$t202kw = $_GET['t202kw'];
$c1 = $_GET['c1'];
$c2 = $_GET['c2'];
$c3 = $_GET['c3'];
$c4 = $_GET['c4'];
$c5 = $_GET['c5'];
$geoip = geoip_record_by_name( $_SERVER['REMOTE_ADDR'] );
$country_code = $geoip['country_code'];
//simple redirect
switch($country_code) {
case 'US':
header('Location: http://mydomain.com/tracking202/redirect/dl.php?t202id=129&t202kw='.$t202kw.'&c1='.$c1.'&c2='.$c2.'&c3='.$c3.'&c4='.$c4.'&c5='.$c5);
exit;
default: // exceptions
header('Location: http://google.com/');
exit;
}
?>
http://mydomain.com/redirect.php?t202id=129&t202kw=test
By the way, to stay on topic what is the fastest code: php or java based?
@peanut Javascript you mean? PHP is server side so more useful for geo-redirection. Javascript geo-detection for the purposes of redirection like above will always be slower as it requires the user to load and render the page... Most PHP processing is going to happen in a few milliseconds + time of additional redirect between links. When it comes to on-page processing, e.g. looking someone's city/state to drop on the page, PHP code undoubtedly smashes anything javascript that has to call on another server (e.g. maxmind javascript service). If the javascript calls on something local then they may get closer in performance... but for simple things it's better not to rely on people's browsers/computers when you can avoid it.
@mrnhat1809 first thing you should do is test/confirm your geoip installation even works. Upload the following script and load it - should spit out geo-data based on your IP:
[PHP]
<?php
$record = geoip_record_by_name( $_SERVER['REMOTE_ADDR'] );
var_dump($record);
echo '<br />';
echo 'Country code: '.$record['country_code3'].'<br />';
echo "City: " .$record['city'].'<br />';
echo "Region: " .$record['region'].'<br />';
?>
[/PHP]
@zeno
result
NULL
Country code:
City:
Region:
I think geo installation did not work, contact support now
@zeno
It works perfectly now zeno. Thanks alot. Thank you
Great, glad it all worked out!