Home > Paid Traffic Sources > Facebook & Instagram

Anyone has geo redirect script for prosper202? (14)


08-26-2013 01:06 AM #1 mrnhat1809 (Member)
Anyone has geo redirect script for prosper202?

Hi
Anyone here can share country GEO redirect script for prosper202 please? Thanks alot


08-26-2013 02:13 AM #2 vokesdil (Member)

why use the GEO redirect script on facebook? your audiences are sure someone country.


08-26-2013 03:20 AM #3 mrnhat1809 (Member)

Quote Originally Posted by vokesdil View Post
why use the GEO redirect script on facebook? your audiences are sure someone country.
Not all clicks come from your target country, they also have clicks on other countries, I want to use GEO redirect to control quality of clicks


08-26-2013 02:47 PM #4 caurmen (Administrator)

I think this is what you're looking for!


08-27-2013 02:01 PM #5 ThrvTrkr (Member)

Here you go man:

http://ipyxel.com/redirect-internati...geo-targeting/


08-28-2013 12:19 AM #6 mrnhat1809 (Member)

Quote Originally Posted by caurmen View Post
As your code written
Code:
<?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;
}
?>
I don't use lander so what should i do now.
Suppose my tracking link is
Code:
http://mydomain.com/tracking202/redirect/dl.php?t202id=129&t202kw=test
with keyword is test, i'll put this link to offer URL in the code above? if so what my link flow will be? i don't really understand please help me out. Thank you


08-28-2013 12:21 AM #7 mrnhat1809 (Member)

Quote Originally Posted by ffclogin View Post
Same, since i don't use landing page i don't know where to put that code in, any suggestion for direct linking with GEO redirect?


08-28-2013 01:24 AM #8 zeno (Administrator)

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.


08-28-2013 02:53 AM #9 mrnhat1809 (Member)

@zeno Thank for the code but seem it has something wrong on my side. This is exactly what i did

Code:
<?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;
} 
?>
save the code as redirect.php and uploaded to my site, my track link is
Code:
http://mydomain.com/redirect.php?t202id=129&t202kw=test
but all country redirected to google.com only, I tested with US IP but it redirects to google too. Can you look at this and tell me whats wrong? I also installed maxmind database on my server as well. This is Prosper202 NOT STM Mobile Tracker btw


08-28-2013 04:56 AM #10 peanut (Member)

By the way, to stay on topic what is the fastest code: php or java based?


08-28-2013 05:49 AM #11 zeno (Administrator)

@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]


08-28-2013 09:03 AM #12 mrnhat1809 (Member)

@zeno
result
NULL
Country code:
City:
Region:
I think geo installation did not work, contact support now


08-28-2013 09:47 AM #13 mrnhat1809 (Member)

@zeno
It works perfectly now zeno. Thanks alot. Thank you


08-28-2013 10:46 AM #14 zeno (Administrator)

Great, glad it all worked out!


Home > Paid Traffic Sources > Facebook & Instagram