How to use geo targeting on Dub.co?

Learn how to use geo targeting on Dub.co to redirect your users to different links based on their location.

Steven Tey

Written by Steven Tey

This feature is only available for Pro plans and above.

Geo Targeting is a powerful feature that lets you redirect your users to different links based on their location.

This is useful if you want to do location-based personalization. For example, you can redirect your UK users to a UK-specific landing page, with the rest of the world going to your global landing page.

To use this feature, click on the Targeting button in the link builder. This will open a new modal with geo targeting options.

You can also quickly access the geo targeting feature by using the keyboard shortcut G while in the link builder.

To set up a geo-targeted link, you'll need to provide the following information:

  1. Country: The country that you want to target.
  2. URL: The URL that you want to redirect your users to if they are from the country that you have selected.

You can also add multiple geo-targeted URLs by clicking on the "Add location" button.

Once you have added the locations and URLs, click on the "Add targeting" button to create your geo-targeted link.

When your users click on the link, they will be redirected to the URL that you have specified based on their location.

Usage with the Dub.co API

You can also use the Dub.co API to create geo-targeted links.

To do this, you will need to set the geo field in the link creation request. The geo field should be an object with a valid country code as the key and the respective URL as the value.

{
  "url": "https://example.com",
  "geo": {
    "US": "https://example.com/us",
    "GB": "https://example.com/uk"
  }
}

List of valid country codes

Here's a list of valid country codes that you can use with the Dub.co API:

Country CodeCountry Name
AFAfghanistan
ALAlbania
DZAlgeria
ASAmerican Samoa
ADAndorra
AOAngola
AIAnguilla
AQAntarctica
AGAntigua and Barbuda
ARArgentina
AMArmenia
AWAruba
AUAustralia
ATAustria
AZAzerbaijan
BSBahamas
BHBahrain
BDBangladesh
BBBarbados
BYBelarus
BEBelgium
BZBelize
BJBenin
BMBermuda
BTBhutan
BOBolivia
BABosnia and Herzegovina
BWBotswana
BVBouvet Island
BRBrazil
IOBritish Indian Ocean Territory
BNBrunei Darussalam
BGBulgaria
BFBurkina Faso
BIBurundi
KHCambodia
CMCameroon
CACanada
CVCape Verde
KYCayman Islands
CFCentral African Republic
TDChad
CLChile
CNChina
CXChristmas Island
CCCocos (Keeling) Islands
COColombia
KMComoros
CGCongo (Republic)
CDCongo (Democratic Republic)
CKCook Islands
CRCosta Rica
CIIvory Coast
HRCroatia
CUCuba
CYCyprus
CZCzech Republic
DKDenmark
DJDjibouti
DMDominica
DODominican Republic
ECEcuador
EGEgypt
SVEl Salvador
GQEquatorial Guinea
EREritrea
EEEstonia
ETEthiopia
FKFalkland Islands
FOFaroe Islands
FJFiji
FIFinland
FRFrance
GFFrench Guiana
PFFrench Polynesia
TFFrench Southern Territories
GAGabon
GMGambia
GEGeorgia
DEGermany
GHGhana
GIGibraltar
GRGreece
GLGreenland
GDGrenada
GPGuadeloupe
GUGuam
GTGuatemala
GNGuinea
GWGuinea-Bissau
GYGuyana
HTHaiti
HMHeard Island and McDonald Islands
VAVatican City
HNHonduras
HKHong Kong
HUHungary
ISIceland
INIndia
IDIndonesia
IRIran
IQIraq
IEIreland
ILIsrael
ITItaly
JMJamaica
JPJapan
JOJordan
KZKazakhstan
KEKenya
KIKiribati
KPNorth Korea
KRSouth Korea
KWKuwait
KGKyrgyzstan
LALaos
LVLatvia
LBLebanon
LSLesotho
LRLiberia
LYLibya
LILiechtenstein
LTLithuania
LULuxembourg
MOMacao
MGMadagascar
MWMalawi
MYMalaysia
MVMaldives
MLMali
MTMalta
MHMarshall Islands
MQMartinique
MRMauritania
MUMauritius
YTMayotte
MXMexico
FMMicronesia
MDMoldova
MCMonaco
MNMongolia
MSMontserrat
MAMorocco
MZMozambique
MMMyanmar
NANamibia
NRNauru
NPNepal
NLNetherlands
NCNew Caledonia
NZNew Zealand
NINicaragua
NENiger
NGNigeria
NUNiue
NFNorfolk Island
MKMacedonia
MPNorthern Mariana Islands
NONorway
OMOman
PKPakistan
PWPalau
PSPalestine
PAPanama
PGPapua New Guinea
PYParaguay
PEPeru
PHPhilippines
PNPitcairn
PLPoland
PTPortugal
PRPuerto Rico
QAQatar
REReunion
RORomania
RURussia
RWRwanda
SHSaint Helena
KNSaint Kitts and Nevis
LCSaint Lucia
PMSaint Pierre and Miquelon
VCSaint Vincent and the Grenadines
WSSamoa
SMSan Marino
STSao Tome and Principe
SASaudi Arabia
SNSenegal
SCSeychelles
SLSierra Leone
SGSingapore
SKSlovakia
SISlovenia
SBSolomon Islands
SOSomalia
ZASouth Africa
GSSouth Georgia and the South Sandwich Islands
ESSpain
LKSri Lanka
SDSudan
SRSuriname
SJSvalbard and Jan Mayen
SZEswatini
SESweden
CHSwitzerland
SYSyrian Arab Republic
TWTaiwan
TJTajikistan
TZTanzania
THThailand
TLTimor-Leste
TGTogo
TKTokelau
TOTonga
TTTrinidad and Tobago
TNTunisia
TRTurkey
TMTurkmenistan
TCTurks and Caicos Islands
TVTuvalu
UGUganda
UAUkraine
AEUnited Arab Emirates
GBUnited Kingdom
USUnited States
UMUnited States Minor Outlying Islands
UYUruguay
UZUzbekistan
VUVanuatu
VEVenezuela
VNVietnam
VGVirgin Islands, British
VIVirgin Islands, U.S.
WFWallis and Futuna
EHWestern Sahara
YEYemen
ZMZambia
ZWZimbabwe
AXÅland Islands
BQBonaire, Sint Eustatius and Saba
CWCuraçao
GGGuernsey
IMIsle of Man
JEJersey
MEMontenegro
BLSaint Barthélemy
MFSaint Martin (French part)
RSSerbia
SXSint Maarten (Dutch part)
SSSouth Sudan
XKKosovo

Did this answer your question?