Geo location - Country / Region / City

Display list of countries, regions and cities where your visitors come from.

API Usage

This API produces a json array.

Parameters

One or more of the following parameters are required:

date Calculate the top countries, regions or cities from the specified date entered as yyyy-MM-dd. Default is the current date.
unixTime Calculate the top countries, regions or cities from the specified unix timestamp. Default is the current unix timestamp.
period Specify the period:

  • d for days, eg: period=14d will show 14rows with daily trends, period=d defaults to 1 day
  • w for weeks, eg: period=12w will show 12 rows with weekly trends, period=w defaults to 1 week
  • m for months, eg: period=4m will show 4 rows with monthly trends, period=m defaults to 1 month

timeZone Calculate the top countries, regions or cities for the specified timezone. Default is site's defined timezone.
detailLevel Display data for the specified type of detail level. The values can be [country]|region|city.
countryCode Calculate the top regions or cities for the specified country code. You can get a list of country codes recorded, by calling a api call without providing any filters. See the examples section below. A list is also provided here.
regionCode Calculate the top cities for the specified region code. Note : top cities are calculated when both, country code and region code are specified. You can get a list of region codes recorded by specifying a country code you are interested in. See the examples section below. A list is also provided here.

Optional parameters:

login Your opentracker login email. Default is [demo@opentracker.net].
password Your password.
ticketId A ticketId can be used to provide credentials with an expiring token. A ticketId can be used instead of a login/ password combination. Further information can be found here.
segment This is the property field based on which you want to segment the data. By default there are no segments. You can find more information here.
filter You can choose to see no segments [none] (default), see all segments showAllSorts, or by specifying the name of the segment.
site The site for which to display data. Default is [www.opentracker.net].
locale The locale parameter is an identifier for a particular combination of language and region (e.g. en_US) and determines the format of the data returned. A list of locales can be found here.
ignoreLocale Display columns without language translation [false]|true.
dataType The dataType parameter determines the format of the data returned. Values can be [ json ] | html | jsondatatable | jsonjqgrid | csv | png

Examples

Display a top regions list of US for the website www.opentracker.net from 2024-12-19 and three weeks back display:
HTTP GET/ POST:/api/location/top_country_region_city.jsp?date=2024-12-19&login=demo@opentracker.net&password=demo123&site=www.opentracker.net&period=3w&dataType=html&detailLevel=region&countryCode=US
Display a top cities list in the California region (regionCode: CA) from the country United States (countryCode: US) for the website www.opentracker.net for 2024-12-19:
HTTP GET/ POST:/api/location/top_country_region_city.jsp?date=2024-12-19&detailLevel=city&countryCode=US®ionCode=CA&period=1d
Display a top countries list for the website www.opentracker.net for the user "demo@opentracker.net" with password "demo123":
HTTP GET/ POST:/api/location/top_country_region_city.jsp?period=1d&login=demo@opentracker.net&password=demo123&site=www.opentracker.net

Response

This last example returns a json array with 'n' entries starting from the specified period formatted as:

{ "resultsList": [
{
"No.":"1",
"flag":"",
"country / region / city":"India",
"code":"IN",
"users":"512",
"graph":"||||||||||||||||||||",
"percentage":"29.3%",
"sessions":"590"}
,
{
"No.":"2",
"flag":"",
"country / region / city":"United States",
"code":"US",
"users":"330",
"graph":"|||||||||||||",
"percentage":"18.9%",
"sessions":"367"}
,
{
"No.":"3",
"flag":"",
"country / region / city":"Indonesia",
"code":"ID",
"users":"107",
"graph":"||||",
"percentage":"6.1%",
"sessions":"121"}
,
{
"No.":"4",
"flag":"",
"country / region / city":"Philippines",
"code":"PH",
"users":"90",
"graph":"||||",
"percentage":"5.1%",
"sessions":"115"}
,
{
"No.":"5",
"flag":"",
"country / region / city":"United Kingdom",
"code":"GB",
"users":"61",
"graph":"||",
"percentage":"3.5%",
"sessions":"63"}
,
{
"No.":"6",
"flag":"",
"country / region / city":"Canada",
"code":"CA",
"users":"53",
"graph":"||",
"percentage":"3.0%",
"sessions":"58"}
,
{
"No.":"7",
"flag":"",
"country / region / city":"Germany",
"code":"DE",
"users":"52",
"graph":"||",
"percentage":"3.0%",
"sessions":"55"}
,
{
"No.":"8",
"flag":"",
"country / region / city":"Australia",
"code":"AU",
"users":"42",
"graph":"||",
"percentage":"2.4%",
"sessions":"46"}
,
{
"No.":"9",
"flag":"",
"country / region / city":"United Arab Emirates",
"code":"AE",
"users":"27",
"graph":"|",
"percentage":"1.5%",
"sessions":"29"}
,
{
"No.":"10",
"flag":"",
"country / region / city":"Pakistan",
"code":"PK",
"users":"27",
"graph":"|",
"percentage":"1.5%",
"sessions":"28"}
,
{
"No.":"11",
"flag":"",
"country / region / city":"Nigeria",
"code":"NG",
"users":"22",
"graph":"|",
"percentage":"1.3%",
"sessions":"30"}
,
{
"No.":"12",
"flag":"",
"country / region / city":"France",
"code":"FR",
"users":"19",
"graph":"|",
"percentage":"1.1%",
"sessions":"22"}
,
{
"No.":"13",
"flag":"",
"country / region / city":"Bangladesh",
"code":"BD",
"users":"18",
"graph":"|",
"percentage":"1.0%",
"sessions":"18"}
,
{
"No.":"14",
"flag":"",
"country / region / city":"Italy",
"code":"IT",
"users":"17",
"graph":"|",
"percentage":"1.0%",
"sessions":"17"}
,
{
"No.":"15",
"flag":"",
"country / region / city":"Cambodia",
"code":"KH",
"users":"15",
"graph":"|",
"percentage":"0.9%",
"sessions":"16"}
,
{
"No.":"16",
"flag":"",
"country / region / city":"Brazil",
"code":"BR",
"users":"15",
"graph":"|",
"percentage":"0.9%",
"sessions":"17"}
,
{
"No.":"17",
"flag":"",
"country / region / city":"Mexico",
"code":"MX",
"users":"15",
"graph":"|",
"percentage":"0.9%",
"sessions":"18"}
,
{
"No.":"18",
"flag":"",
"country / region / city":"New Zealand",
"code":"NZ",
"users":"14",
"graph":"|",
"percentage":"0.8%",
"sessions":"14"}
,
{
"No.":"19",
"flag":"",
"country / region / city":"Netherlands",
"code":"NL",
"users":"14",
"graph":"|",
"percentage":"0.8%",
"sessions":"14"}
,
{
"No.":"20",
"flag":"",
"country / region / city":"China",
"code":"CN",
"users":"14",
"graph":"|",
"percentage":"0.8%",
"sessions":"14"}
,
{
"No.":"21",
"flag":"",
"country / region / city":"Egypt",
"code":"EG",
"users":"13",
"graph":"|",
"percentage":"0.7%",
"sessions":"14"}
,
{
"No.":"22",
"flag":"",
"country / region / city":"Singapore",
"code":"SG",
"users":"12",
"graph":"|",
"percentage":"0.7%",
"sessions":"13"}
,
{
"No.":"23",
"flag":"",
"country / region / city":"Romania",
"code":"RO",
"users":"11",
"graph":"|",
"percentage":"0.6%",
"sessions":"11"}
,
{
"No.":"24",
"flag":"",
"country / region / city":"Belgium",
"code":"BE",
"users":"10",
"graph":"|",
"percentage":"0.6%",
"sessions":"10"}
,
{
"No.":"25",
"flag":"",
"country / region / city":"Spain",
"code":"ES",
"users":"10",
"graph":"|",
"percentage":"0.6%",
"sessions":"10"}
,
{
"No.":"26",
"flag":"",
"country / region / city":"Malaysia",
"code":"MY",
"users":"10",
"graph":"|",
"percentage":"0.6%",
"sessions":"10"}
,
{
"No.":"27",
"flag":"",
"country / region / city":"South Korea",
"code":"KR",
"users":"10",
"graph":"|",
"percentage":"0.6%",
"sessions":"11"}
,
{
"No.":"28",
"flag":"",
"country / region / city":"Vietnam",
"code":"VN",
"users":"9",
"graph":"|",
"percentage":"0.5%",
"sessions":"9"}
,
{
"No.":"29",
"flag":"",
"country / region / city":"Japan",
"code":"JP",
"users":"9",
"graph":"|",
"percentage":"0.5%",
"sessions":"9"}
,
{
"No.":"30",
"flag":"",
"country / region / city":"Sweden",
"code":"SE",
"users":"8",
"graph":"|",
"percentage":"0.5%",
"sessions":"9"}
,
{
"No.":"31",
"flag":"",
"country / region / city":"Switzerland",
"code":"CH",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"7"}
,
{
"No.":"32",
"flag":"",
"country / region / city":"Ireland",
"code":"IE",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"8"}
,
{
"No.":"33",
"flag":"",
"country / region / city":"Denmark",
"code":"DK",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"7"}
,
{
"No.":"34",
"flag":"",
"country / region / city":"Argentina",
"code":"AR",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"6"}
,
{
"No.":"35",
"flag":"",
"country / region / city":"Thailand",
"code":"TH",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"6"}
,
{
"No.":"36",
"flag":"",
"country / region / city":"Algeria",
"code":"DZ",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"7"}
,
{
"No.":"37",
"flag":"",
"country / region / city":"Saudi Arabia",
"code":"SA",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"6"}
,
{
"No.":"38",
"flag":"",
"country / region / city":"Norway",
"code":"NO",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"6"}
,
{
"No.":"39",
"flag":"",
"country / region / city":"Greece",
"code":"GR",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"5"}
,
{
"No.":"40",
"flag":"",
"country / region / city":"Morocco",
"code":"MA",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"7"}
,
{
"No.":"41",
"flag":"",
"country / region / city":"Poland",
"code":"PL",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"5"}
,
{
"No.":"42",
"flag":"",
"country / region / city":"Israel",
"code":"IL",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"5"}
,
{
"No.":"43",
"flag":"",
"country / region / city":"Russian Federation",
"code":"RU",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"5"}
,
{
"No.":"44",
"flag":"",
"country / region / city":"Serbia and Montenegro",
"code":"RS",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"5"}
,
{
"No.":"45",
"flag":"",
"country / region / city":"Unknown",
"code":"CW",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"46",
"flag":"",
"country / region / city":"Nepal",
"code":"NP",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"47",
"flag":"",
"country / region / city":"Taiwan",
"code":"TW",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"48",
"flag":"",
"country / region / city":"Hong Kong",
"code":"HK",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"49",
"flag":"",
"country / region / city":"Hungary",
"code":"HU",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"50",
"flag":"",
"country / region / city":"Portugal",
"code":"PT",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"51",
"flag":"",
"country / region / city":"Iran",
"code":"IR",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"52",
"flag":"",
"country / region / city":"Turkey",
"code":"TR",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"53",
"flag":"",
"country / region / city":"Costa Rica",
"code":"CR",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"54",
"flag":"",
"country / region / city":"Bulgaria",
"code":"BG",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"55",
"flag":"",
"country / region / city":"Kuwait",
"code":"KW",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"56",
"flag":"",
"country / region / city":"Sri Lanka",
"code":"LK",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"57",
"flag":"",
"country / region / city":"Czech Republic",
"code":"CZ",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"58",
"flag":"",
"country / region / city":"Qatar",
"code":"QA",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"59",
"flag":"",
"country / region / city":"Uzbekistan",
"code":"UZ",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"60",
"flag":"",
"country / region / city":"Chile",
"code":"CL",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"61",
"flag":"",
"country / region / city":"South Africa",
"code":"ZA",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"62",
"flag":"",
"country / region / city":"Jamaica",
"code":"JM",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"63",
"flag":"",
"country / region / city":"Yemen",
"code":"YE",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"64",
"flag":"",
"country / region / city":"Croatia",
"code":"HR",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"65",
"flag":"",
"country / region / city":"Kenya",
"code":"KE",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"3"}
,
{
"No.":"66",
"flag":"",
"country / region / city":"Austria",
"code":"AT",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"67",
"flag":"",
"country / region / city":"Luxembourg",
"code":"LU",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"3"}
,
{
"No.":"68",
"flag":"",
"country / region / city":"Albania",
"code":"AL",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"69",
"flag":"",
"country / region / city":"Macedonia",
"code":"ME",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"70",
"flag":"",
"country / region / city":"Malta",
"code":"MT",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"71",
"flag":"",
"country / region / city":"Lithuania",
"code":"LT",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"72",
"flag":"",
"country / region / city":"Latvia",
"code":"LV",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"73",
"flag":"",
"country / region / city":"Ukraine",
"code":"UA",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"74",
"flag":"",
"country / region / city":"Ghana",
"code":"GH",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"75",
"flag":"",
"country / region / city":"Maldives",
"code":"MV",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"76",
"flag":"",
"country / region / city":"Namibia",
"code":"NA",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"77",
"flag":"",
"country / region / city":"Georgia",
"code":"GE",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"78",
"flag":"",
"country / region / city":"Peru",
"code":"PE",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"79",
"flag":"",
"country / region / city":"Jordan",
"code":"JO",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"80",
"flag":"",
"country / region / city":"Tunisia",
"code":"TN",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"81",
"flag":"",
"country / region / city":"French Polynesia",
"code":"PF",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"82",
"flag":"",
"country / region / city":"Palestine",
"code":"PS",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"83",
"flag":"",
"country / region / city":"Lebanon",
"code":"LB",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"84",
"flag":"",
"country / region / city":"Venezuela",
"code":"VE",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"85",
"flag":"",
"country / region / city":"Azerbaijan",
"code":"AZ",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"86",
"flag":"",
"country / region / city":"Estonia",
"code":"EE",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"87",
"flag":"",
"country / region / city":"Myanmar",
"code":"MM",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"88",
"flag":"",
"country / region / city":"Cameroon",
"code":"CM",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"89",
"flag":"",
"country / region / city":"Cyprus",
"code":"CY",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"90",
"flag":"",
"country / region / city":"Kazakstan",
"code":"KZ",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"91",
"flag":"",
"country / region / city":"Oman",
"code":"OM",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"92",
"flag":"",
"country / region / city":"Iceland",
"code":"IS",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"93",
"flag":"",
"country / region / city":"Colombia",
"code":"CO",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"94",
"flag":"",
"country / region / city":"Honduras",
"code":"HN",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"95",
"flag":"",
"country / region / city":"Slovakia",
"code":"SK",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"96",
"flag":"",
"country / region / city":"Togo",
"code":"TG",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"97",
"flag":"",
"country / region / city":"Dominican Republic",
"code":"DO",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"98",
"flag":"",
"country / region / city":"Uganda",
"code":"UG",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"99",
"flag":"",
"country / region / city":"Dominica",
"code":"DM",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"",
"flag":"",
"country / region / city":"",
"code":"",
"users":"1,749",
"graph":"",
"percentage":"100%",
"sessions":"1,952"}
]
}

Errors

If errors are encountered, the first encountered error will be returned of form "Error: exception: message

Error: java.lang.RuntimeException: Login/ site combination is not valid

We would love to hear your feedback. Please use the facebook comment box below