How to redirect users to an offer according to their country.
2015-03-23, 09:43 PM,
#1
Say I want to redirect Frenchies to an offer from network #1 and US citizens to an offer from network #2. How can I do this?

[Image: R5I6Tcg.gif]
Reply
2015-03-23, 10:06 PM,
#2
You can use

Code:
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', '//ipinfo.io', true);
xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4) {
        if(xmlhttp.status == 200) {
            var obj = JSON.parse(xmlhttp.responseText);
            if (obj.country == 'FR')
                window.location.replace('OFFER FOR N#1');
             if (obj.country == 'US')
                window.location.replace('OFFER FOR N#2');
         }
    }
};
xmlhttp.send(null);

Note that you are using ipinfo.io data, if the site goes down, the script goes down, there's a lot of javascript libs for this, but the code above is the quickest, in my opinion.

Other option, may be faster....

Code:
<script language="Javascript" src="http://gd.geobytes.com/Gd?after=-1"></script>
    <script language="javascript">
var finded = false,
    redirections = {
        UK: 'http://www.adworkmedia.com/.....',
        US: 'http://www.cpagrip.com....',
        CA: 'French.htm',   // Canada
        CH: 'Chinese.htm'   // China
    };
//* Checking location code
if(typeof(sGeobytesLocationCode) != "undefined")
{
    var sCountryCode = sGeobytesLocationCode.substring(0,2);
    for(var i in redirections) {
        if(i == sCountryCode) {
            document.write("<META HTTP-EQUIV='Refresh' CONTENT='0; URL=" + redirections[i] + "'>");
            finded = true;
        }
    }
}
//* location code not finded - redirect to default page
if(!finded) {
    document.write("<META HTTP-EQUIV='Refresh' CONTENT='0; URL=World.htm'>");
}
    </script>
Latest Thanks - View all

DaveNL(2015-03-23 11:54 PM) Adept(2015-03-23 10:41 PM) 
Reply
2015-03-23, 10:42 PM,
#3
(2015-03-23, 10:06 PM)Imfc Wrote: You can use

Code:
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', '//ipinfo.io', true);
xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4) {
        if(xmlhttp.status == 200) {
            var obj = JSON.parse(xmlhttp.responseText);
            if (obj.country == 'FR')
                window.location.replace('OFFER FOR N#1');
             if (obj.country == 'US')
                window.location.replace('OFFER FOR N#2');
         }
    }
};
xmlhttp.send(null);

Note that you are using ipinfo.io data, if the site goes down, the script goes down, there's a lot of javascript libs for this, but the code above is the quickest, in my opinion.

Other option, may be faster....

Code:
<script language="Javascript" src="/Gd?after=-1"></script>
    <script language="javascript">
var finded = false,
    redirections = {
        UK: '/.....',
        US: '....',
        CA: 'French.htm',   // Canada
        CH: 'Chinese.htm'   // China
    };
//* Checking location code
if(typeof(sGeobytesLocationCode) != "undefined")
{
    var sCountryCode = sGeobytesLocationCode.substring(0,2);
    for(var i in redirections) {
        if(i == sCountryCode) {
            document.write("<META HTTP-EQUIV='Refresh' CONTENT='0; URL=" + redirections[i] + "'>");
            finded = true;
        }
    }
}
//* location code not finded - redirect to default page
if(!finded) {
    document.write("<META HTTP-EQUIV='Refresh' CONTENT='0; URL=World.htm'>");
}
    </script>
Sweet! Thank you! :D

[Image: R5I6Tcg.gif]
Reply
2015-03-23, 11:55 PM,
#4
Thanks for that +3 rep
Reply
2015-03-24, 01:19 AM,
#5
(2015-03-23, 11:55 PM)DaveNL Wrote: Thanks for that +3 rep

Hm , thanks daveNL!
Reply
2015-03-24, 03:00 AM,
(This post was last modified: 2015-03-24, 03:05 AM by drone43.)
#6
Thanks Imfc for the code . Suppose I want to send french , netherland to cpa ( for example cpagrip) and remaining to pay per instal( example amonetize : it uses javascript code for download link) . I provide 1 download button in my website. People have to click download link and then they will be redirected to offer/network based on country . How redirection is done in this case ? I'll be very helpful if you can help me with this implementation. Thanks for help in advance
Reply
2015-03-24, 03:40 AM,
#7
one word "prosper202"
Reply
2015-03-24, 10:25 AM,
#8
Some of these scripts do not work on certain browsers, is there a script that works on the big 3? That is Chrome, firefox and Internet Explorer.
Reply
2015-03-25, 02:50 AM,
#9
Anyone with a script that sends US, Uk and Can nationals to 1 offer and the rest of the word to another offer?
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Help] cpagrip pin offer denied!! sidhesha 4 145 2017-10-17, 09:00 AM
Last Post: sidhesha
  What is offer wall in CPA Networks? Captain Obvious 5 651 2017-10-14, 10:58 AM
Last Post: lisabarry
  Would This Work? [Offer Wall] ThaRealGold 3 328 2017-10-14, 10:56 AM
Last Post: lisabarry
  CPA Grip offer wall spaceboos 3 956 2017-10-14, 08:34 AM
Last Post: lisabarry
  [HELP] How to export a list of users who commented on an instagram post? SeoFreak 3 143 2017-10-02, 10:07 PM
Last Post: sudirbhai




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top