The Most Active and Friendliest
Affiliate Marketing Community Online!

“Propeller”/  Direct Affiliate

[Script] Redirect by Country, GeoLocation Javascript Tool

Skyy

New Member
affiliate
Good day everyone!
I'm new here, I've been a backpacking digital nomad for a few years now. Currently in Moscow with my Russian girlfriend I met in Thailand. Want a good girl? Russians..

Anyways, For my first post to the community I decided to add some value, and post a script that I'm sure some are aware of already, but it's very helpful for the people who do not know.
This is a Javascript code I wrote to redirect people based on their country code,
it is very simple yet very powerful in the affiliate game.

You can add as many countries as you like, just keep making more "else if's".
You can add direct affiliate links or multiple landing pages, whichever you prefer. You can also edit this code and stick it in the final button of your landing page to redirect after you get their email. However you want to do it.

Some uses for it I found:
-If you have a different offer for every country, in the same vertical, and want to use one link so you don't have to set up different links and ad campaigns for each country.
-Some ad platforms will reject your ad because they can't see the final offer because the offer is for another country, and the country they're looking from isn't accepted. Send them to another offer via this code, and your Ad is accepted.
-The final code redirects everyone not listed to another site, I attach a link to an offer that is an international or multiple geo-location affiliate link.
-You can use this as Cloaking, but I only use it for clean whitehat purposes.
-more uses but I can't give away all my secrets.

GeoLocation Javascript Code:
HTML:
<html>
<head>
    <script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
    <script>
        if (geoplugin_countryCode() == "US") {
            window.location.href = "http://YourAffiliateLink.com"    <!-- This directs to United States -->
        } else if (geoplugin_countryCode() == "GB") {
            window.location.href = "http://YourAffiliateLink.com"    <!-- This directs to United Kingdom -->
        } else if (geoplugin_countryCode() == "RU") {
            window.location.href = "http://YourAffiliateLink.com"    <!-- This directs to Russia -->
        } else {
            window.location.href = "http://YourAffiliateLink.com"    <!-- This directs to Every Other country -->
        }
    
        <!-- You can use this Alert for testing purposes, it includes City, Country Name, and Country Code -->
        <!-- alert(geoplugin_city() + ", " + geoplugin_countryName() + ", " + geoplugin_countryCode()); -->
    </script>
 
</head>
<body>

</body>
</html>

Here is the list of all Country Codes:
Code:
A1,"Anonymous Proxy"
A2,"Satellite Provider"
O1,"Other Country"
AD,"Andorra"
AE,"United Arab Emirates"
AF,"Afghanistan"
AG,"Antigua and Barbuda"
AI,"Anguilla"
AL,"Albania"
AM,"Armenia"
AO,"Angola"
AP,"Asia/Pacific Region"
AQ,"Antarctica"
AR,"Argentina"
AS,"American Samoa"
AT,"Austria"
AU,"Australia"
AW,"Aruba"
AX,"Aland Islands"
AZ,"Azerbaijan"
BA,"Bosnia and Herzegovina"
BB,"Barbados"
BD,"Bangladesh"
BE,"Belgium"
BF,"Burkina Faso"
BG,"Bulgaria"
BH,"Bahrain"
BI,"Burundi"
BJ,"Benin"
BL,"Saint Barthelemy"
BM,"Bermuda"
BN,"Brunei Darussalam"
BO,"Bolivia"
BQ,"Bonaire, Saint Eustatius and Saba"
BR,"Brazil"
BS,"Bahamas"
BT,"Bhutan"
BV,"Bouvet Island"
BW,"Botswana"
BY,"Belarus"
BZ,"Belize"
CA,"Canada"
CC,"Cocos (Keeling) Islands"
CD,"Congo, The Democratic Republic of the"
CF,"Central African Republic"
CG,"Congo"
CH,"Switzerland"
CI,"Cote d'Ivoire"
CK,"Cook Islands"
CL,"Chile"
CM,"Cameroon"
CN,"China"
CO,"Colombia"
CR,"Costa Rica"
CU,"Cuba"
CV,"Cape Verde"
CW,"Curacao"
CX,"Christmas Island"
CY,"Cyprus"
CZ,"Czech Republic"
DE,"Germany"
DJ,"Djibouti"
DK,"Denmark"
DM,"Dominica"
DO,"Dominican Republic"
DZ,"Algeria"
EC,"Ecuador"
EE,"Estonia"
EG,"Egypt"
EH,"Western Sahara"
ER,"Eritrea"
ES,"Spain"
ET,"Ethiopia"
EU,"Europe"
FI,"Finland"
FJ,"Fiji"
FK,"Falkland Islands (Malvinas)"
FM,"Micronesia, Federated States of"
FO,"Faroe Islands"
FR,"France"
GA,"Gabon"
GB,"United Kingdom"
GD,"Grenada"
GE,"Georgia"
GF,"French Guiana"
GG,"Guernsey"
GH,"Ghana"
GI,"Gibraltar"
GL,"Greenland"
GM,"Gambia"
GN,"Guinea"
GP,"Guadeloupe"
GQ,"Equatorial Guinea"
GR,"Greece"
GS,"South Georgia and the South Sandwich Islands"
GT,"Guatemala"
GU,"Guam"
GW,"Guinea-Bissau"
GY,"Guyana"
HK,"Hong Kong"
HM,"Heard Island and McDonald Islands"
HN,"Honduras"
HR,"Croatia"
HT,"Haiti"
HU,"Hungary"
ID,"Indonesia"
IE,"Ireland"
IL,"Israel"
IM,"Isle of Man"
IN,"India"
IO,"British Indian Ocean Territory"
IQ,"Iraq"
IR,"Iran, Islamic Republic of"
IS,"Iceland"
IT,"Italy"
JE,"Jersey"
JM,"Jamaica"
JO,"Jordan"
JP,"Japan"
KE,"Kenya"
KG,"Kyrgyzstan"
KH,"Cambodia"
KI,"Kiribati"
KM,"Comoros"
KN,"Saint Kitts and Nevis"
KP,"Korea, Democratic People's Republic of"
KR,"Korea, Republic of"
KW,"Kuwait"
KY,"Cayman Islands"
KZ,"Kazakhstan"
LA,"Lao People's Democratic Republic"
LB,"Lebanon"
LC,"Saint Lucia"
LI,"Liechtenstein"
LK,"Sri Lanka"
LR,"Liberia"
LS,"Lesotho"
LT,"Lithuania"
LU,"Luxembourg"
LV,"Latvia"
LY,"Libyan Arab Jamahiriya"
MA,"Morocco"
MC,"Monaco"
MD,"Moldova, Republic of"
ME,"Montenegro"
MF,"Saint Martin"
MG,"Madagascar"
MH,"Marshall Islands"
MK,"Macedonia"
ML,"Mali"
MM,"Myanmar"
MN,"Mongolia"
MO,"Macao"
MP,"Northern Mariana Islands"
MQ,"Martinique"
MR,"Mauritania"
MS,"Montserrat"
MT,"Malta"
MU,"Mauritius"
MV,"Maldives"
MW,"Malawi"
MX,"Mexico"
MY,"Malaysia"
MZ,"Mozambique"
NA,"Namibia"
NC,"New Caledonia"
NE,"Niger"
NF,"Norfolk Island"
NG,"Nigeria"
NI,"Nicaragua"
NL,"Netherlands"
NO,"Norway"
NP,"Nepal"
NR,"Nauru"
NU,"Niue"
NZ,"New Zealand"
OM,"Oman"
PA,"Panama"
PE,"Peru"
PF,"French Polynesia"
PG,"Papua New Guinea"
PH,"Philippines"
PK,"Pakistan"
PL,"Poland"
PM,"Saint Pierre and Miquelon"
PN,"Pitcairn"
PR,"Puerto Rico"
PS,"Palestinian Territory"
PT,"Portugal"
PW,"Palau"
PY,"Paraguay"
QA,"Qatar"
RE,"Reunion"
RO,"Romania"
RS,"Serbia"
RU,"Russian Federation"
RW,"Rwanda"
SA,"Saudi Arabia"
SB,"Solomon Islands"
SC,"Seychelles"
SD,"Sudan"
SE,"Sweden"
SG,"Singapore"
SH,"Saint Helena"
SI,"Slovenia"
SJ,"Svalbard and Jan Mayen"
SK,"Slovakia"
SL,"Sierra Leone"
SM,"San Marino"
SN,"Senegal"
SO,"Somalia"
SR,"Suriname"
SS,"South Sudan"
ST,"Sao Tome and Principe"
SV,"El Salvador"
SX,"Sint Maarten"
SY,"Syrian Arab Republic"
SZ,"Swaziland"
TC,"Turks and Caicos Islands"
TD,"Chad"
TF,"French Southern Territories"
TG,"Togo"
TH,"Thailand"
TJ,"Tajikistan"
TK,"Tokelau"
TL,"Timor-Leste"
TM,"Turkmenistan"
TN,"Tunisia"
TO,"Tonga"
TR,"Turkey"
TT,"Trinidad and Tobago"
TV,"Tuvalu"
TW,"Taiwan"
TZ,"Tanzania, United Republic of"
UA,"Ukraine"
UG,"Uganda"
UM,"United States Minor Outlying Islands"
US,"United States"
UY,"Uruguay"
UZ,"Uzbekistan"
VA,"Holy See (Vatican City State)"
VC,"Saint Vincent and the Grenadines"
VE,"Venezuela"
VG,"Virgin Islands, British"
VI,"Virgin Islands, U.S."
VN,"Vietnam"
VU,"Vanuatu"
WF,"Wallis and Futuna"
WS,"Samoa"
YE,"Yemen"
YT,"Mayotte"
ZA,"South Africa"
ZM,"Zambia"
ZW,"Zimbabwe"

Hope this helps someone.
If you have some Javascript Codes or Scripts for affiliate marketing, feel free to share here.

Cheers,
-Skyy
 
Last edited:
geo-js.jpg


377 ms? WTF way too slow
I use Nginx --with-http_geoip_module and the Maxmind GEO-IP database installed on the server <20ms
Point is: for every 100 ms delay you will lose up to 1% of your CTR :eek:
Today the Internet is I want NOW!
 
geo-js.jpg


377 ms? WTF way too slow
I use Nginx --with-http_geoip_module and the Maxmind GEO-IP database installed on the server <20ms
Point is: for every 100 ms delay you will lose up to 1% of your CTR :eek:
Today the Internet is I want NOW!
Good point, I have been bothered with how slow it is.
Can you explain this more, I need a faster method.
 
I've also been bothered with how slow some of MaxBountys offers load after the many redirects they go through, just on the standard affiliate links.
I was testing links to Australia from an Australian server, and page loads were at 10 seconds, before I added anything to them. It's frustrating. (it's an AU offer.)
 
banners
Back