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-11-19 and three weeks back display:
HTTP GET/ POST:/api/location/top_country_region_city.jsp?date=2024-11-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-11-19:
HTTP GET/ POST:/api/location/top_country_region_city.jsp?date=2024-11-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":"479",
"graph":"||||||||||||||||||||",
"percentage":"25.5%",
"sessions":"538"}
,
{
"No.":"2",
"flag":"",
"country / region / city":"United States",
"code":"US",
"users":"383",
"graph":"||||||||||||||||",
"percentage":"20.4%",
"sessions":"516"}
,
{
"No.":"3",
"flag":"",
"country / region / city":"Indonesia",
"code":"ID",
"users":"138",
"graph":"||||||",
"percentage":"7.4%",
"sessions":"148"}
,
{
"No.":"4",
"flag":"",
"country / region / city":"Switzerland",
"code":"CH",
"users":"95",
"graph":"||||",
"percentage":"5.1%",
"sessions":"98"}
,
{
"No.":"5",
"flag":"",
"country / region / city":"Philippines",
"code":"PH",
"users":"78",
"graph":"|||",
"percentage":"4.2%",
"sessions":"84"}
,
{
"No.":"6",
"flag":"",
"country / region / city":"Germany",
"code":"DE",
"users":"57",
"graph":"||",
"percentage":"3.0%",
"sessions":"60"}
,
{
"No.":"7",
"flag":"",
"country / region / city":"United Kingdom",
"code":"GB",
"users":"53",
"graph":"||",
"percentage":"2.8%",
"sessions":"55"}
,
{
"No.":"8",
"flag":"",
"country / region / city":"Canada",
"code":"CA",
"users":"47",
"graph":"||",
"percentage":"2.5%",
"sessions":"49"}
,
{
"No.":"9",
"flag":"",
"country / region / city":"Australia",
"code":"AU",
"users":"41",
"graph":"||",
"percentage":"2.2%",
"sessions":"43"}
,
{
"No.":"10",
"flag":"",
"country / region / city":"Pakistan",
"code":"PK",
"users":"33",
"graph":"|",
"percentage":"1.8%",
"sessions":"35"}
,
{
"No.":"11",
"flag":"",
"country / region / city":"Malaysia",
"code":"MY",
"users":"32",
"graph":"|",
"percentage":"1.7%",
"sessions":"35"}
,
{
"No.":"12",
"flag":"",
"country / region / city":"United Arab Emirates",
"code":"AE",
"users":"31",
"graph":"|",
"percentage":"1.7%",
"sessions":"32"}
,
{
"No.":"13",
"flag":"",
"country / region / city":"Bangladesh",
"code":"BD",
"users":"29",
"graph":"|",
"percentage":"1.5%",
"sessions":"30"}
,
{
"No.":"14",
"flag":"",
"country / region / city":"Cambodia",
"code":"KH",
"users":"23",
"graph":"|",
"percentage":"1.2%",
"sessions":"32"}
,
{
"No.":"15",
"flag":"",
"country / region / city":"Nigeria",
"code":"NG",
"users":"18",
"graph":"|",
"percentage":"1.0%",
"sessions":"23"}
,
{
"No.":"16",
"flag":"",
"country / region / city":"France",
"code":"FR",
"users":"17",
"graph":"|",
"percentage":"0.9%",
"sessions":"18"}
,
{
"No.":"17",
"flag":"",
"country / region / city":"Singapore",
"code":"SG",
"users":"15",
"graph":"|",
"percentage":"0.8%",
"sessions":"15"}
,
{
"No.":"18",
"flag":"",
"country / region / city":"South Africa",
"code":"ZA",
"users":"14",
"graph":"|",
"percentage":"0.7%",
"sessions":"15"}
,
{
"No.":"19",
"flag":"",
"country / region / city":"South Korea",
"code":"KR",
"users":"13",
"graph":"|",
"percentage":"0.7%",
"sessions":"13"}
,
{
"No.":"20",
"flag":"",
"country / region / city":"New Zealand",
"code":"NZ",
"users":"13",
"graph":"|",
"percentage":"0.7%",
"sessions":"14"}
,
{
"No.":"21",
"flag":"",
"country / region / city":"Netherlands",
"code":"NL",
"users":"13",
"graph":"|",
"percentage":"0.7%",
"sessions":"13"}
,
{
"No.":"22",
"flag":"",
"country / region / city":"Japan",
"code":"JP",
"users":"11",
"graph":"|",
"percentage":"0.6%",
"sessions":"13"}
,
{
"No.":"23",
"flag":"",
"country / region / city":"Romania",
"code":"RO",
"users":"11",
"graph":"|",
"percentage":"0.6%",
"sessions":"15"}
,
{
"No.":"24",
"flag":"",
"country / region / city":"Italy",
"code":"IT",
"users":"10",
"graph":"|",
"percentage":"0.5%",
"sessions":"10"}
,
{
"No.":"25",
"flag":"",
"country / region / city":"Mexico",
"code":"MX",
"users":"10",
"graph":"|",
"percentage":"0.5%",
"sessions":"15"}
,
{
"No.":"26",
"flag":"",
"country / region / city":"Nepal",
"code":"NP",
"users":"8",
"graph":"|",
"percentage":"0.4%",
"sessions":"9"}
,
{
"No.":"27",
"flag":"",
"country / region / city":"Thailand",
"code":"TH",
"users":"8",
"graph":"|",
"percentage":"0.4%",
"sessions":"8"}
,
{
"No.":"28",
"flag":"",
"country / region / city":"Sweden",
"code":"SE",
"users":"8",
"graph":"|",
"percentage":"0.4%",
"sessions":"9"}
,
{
"No.":"29",
"flag":"",
"country / region / city":"Portugal",
"code":"PT",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"7"}
,
{
"No.":"30",
"flag":"",
"country / region / city":"Belgium",
"code":"BE",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"7"}
,
{
"No.":"31",
"flag":"",
"country / region / city":"Vietnam",
"code":"VN",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"7"}
,
{
"No.":"32",
"flag":"",
"country / region / city":"Bulgaria",
"code":"BG",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"9"}
,
{
"No.":"33",
"flag":"",
"country / region / city":"Qatar",
"code":"QA",
"users":"7",
"graph":"|",
"percentage":"0.4%",
"sessions":"9"}
,
{
"No.":"34",
"flag":"",
"country / region / city":"Hong Kong",
"code":"HK",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"7"}
,
{
"No.":"35",
"flag":"",
"country / region / city":"Poland",
"code":"PL",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"6"}
,
{
"No.":"36",
"flag":"",
"country / region / city":"Sri Lanka",
"code":"LK",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"6"}
,
{
"No.":"37",
"flag":"",
"country / region / city":"Spain",
"code":"ES",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"8"}
,
{
"No.":"38",
"flag":"",
"country / region / city":"Hungary",
"code":"HU",
"users":"6",
"graph":"|",
"percentage":"0.3%",
"sessions":"6"}
,
{
"No.":"39",
"flag":"",
"country / region / city":"Turkey",
"code":"TR",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"5"}
,
{
"No.":"40",
"flag":"",
"country / region / city":"Austria",
"code":"AT",
"users":"5",
"graph":"|",
"percentage":"0.3%",
"sessions":"5"}
,
{
"No.":"41",
"flag":"",
"country / region / city":"Chile",
"code":"CL",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"42",
"flag":"",
"country / region / city":"Argentina",
"code":"AR",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"43",
"flag":"",
"country / region / city":"Czech Republic",
"code":"CZ",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"44",
"flag":"",
"country / region / city":"El Salvador",
"code":"SV",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"45",
"flag":"",
"country / region / city":"Egypt",
"code":"EG",
"users":"4",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"46",
"flag":"",
"country / region / city":"Greece",
"code":"GR",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"47",
"flag":"",
"country / region / city":"Fiji Islands",
"code":"FJ",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"48",
"flag":"",
"country / region / city":"Zambia",
"code":"ZM",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"49",
"flag":"",
"country / region / city":"Bahrain",
"code":"BH",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"50",
"flag":"",
"country / region / city":"Taiwan",
"code":"TW",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"51",
"flag":"",
"country / region / city":"Israel",
"code":"IL",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"52",
"flag":"",
"country / region / city":"Oman",
"code":"OM",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"53",
"flag":"",
"country / region / city":"Brazil",
"code":"BR",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"54",
"flag":"",
"country / region / city":"Colombia",
"code":"CO",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"8"}
,
{
"No.":"55",
"flag":"",
"country / region / city":"Macedonia",
"code":"MK",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"56",
"flag":"",
"country / region / city":"Saudi Arabia",
"code":"SA",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"57",
"flag":"",
"country / region / city":"Ireland",
"code":"IE",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"58",
"flag":"",
"country / region / city":"Serbia and Montenegro",
"code":"RS",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"59",
"flag":"",
"country / region / city":"Slovakia",
"code":"SK",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"60",
"flag":"",
"country / region / city":"Lithuania",
"code":"LT",
"users":"3",
"graph":"|",
"percentage":"0.2%",
"sessions":"3"}
,
{
"No.":"61",
"flag":"",
"country / region / city":"Benin",
"code":"BJ",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"62",
"flag":"",
"country / region / city":"Morocco",
"code":"MA",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"63",
"flag":"",
"country / region / city":"Iraq",
"code":"IQ",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"64",
"flag":"",
"country / region / city":"Namibia",
"code":"NA",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"65",
"flag":"",
"country / region / city":"Finland",
"code":"FI",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"66",
"flag":"",
"country / region / city":"Peru",
"code":"PE",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"3"}
,
{
"No.":"67",
"flag":"",
"country / region / city":"Costa Rica",
"code":"CR",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"68",
"flag":"",
"country / region / city":"Algeria",
"code":"DZ",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"69",
"flag":"",
"country / region / city":"Russian Federation",
"code":"RU",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"3"}
,
{
"No.":"70",
"flag":"",
"country / region / city":"Dominican Republic",
"code":"DO",
"users":"2",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"71",
"flag":"",
"country / region / city":"Bahamas",
"code":"BS",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"72",
"flag":"",
"country / region / city":"Mongolia",
"code":"MN",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"73",
"flag":"",
"country / region / city":"Iran",
"code":"IR",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"74",
"flag":"",
"country / region / city":"Unknown",
"code":"XK",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"75",
"flag":"",
"country / region / city":"Guatemala",
"code":"GT",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"76",
"flag":"",
"country / region / city":"Guyana",
"code":"GY",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"77",
"flag":"",
"country / region / city":"Ukraine",
"code":"UA",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"4"}
,
{
"No.":"78",
"flag":"",
"country / region / city":"Maldives",
"code":"MV",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"79",
"flag":"",
"country / region / city":"Andorra",
"code":"AD",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"80",
"flag":"",
"country / region / city":"Tunisia",
"code":"TN",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"81",
"flag":"",
"country / region / city":"Croatia",
"code":"HR",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"82",
"flag":"",
"country / region / city":"Kenya",
"code":"KE",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"83",
"flag":"",
"country / region / city":"Brunei",
"code":"BN",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"2"}
,
{
"No.":"84",
"flag":"",
"country / region / city":"Estonia",
"code":"EE",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"85",
"flag":"",
"country / region / city":"Cyprus",
"code":"CY",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"86",
"flag":"",
"country / region / city":"Moldova",
"code":"MD",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"87",
"flag":"",
"country / region / city":"Mauritius",
"code":"MU",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"88",
"flag":"",
"country / region / city":"Albania",
"code":"AL",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"89",
"flag":"",
"country / region / city":"Senegal",
"code":"SN",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"90",
"flag":"",
"country / region / city":"Honduras",
"code":"HN",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"91",
"flag":"",
"country / region / city":"Ethiopia",
"code":"ET",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"92",
"flag":"",
"country / region / city":"Afghanistan",
"code":"AF",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"93",
"flag":"",
"country / region / city":"Bolivia",
"code":"BO",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"94",
"flag":"",
"country / region / city":"Malta",
"code":"MT",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"95",
"flag":"",
"country / region / city":"Bosnia and Herzegovina",
"code":"BA",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"96",
"flag":"",
"country / region / city":"Rwanda",
"code":"RW",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"97",
"flag":"",
"country / region / city":"Uzbekistan",
"code":"UZ",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"98",
"flag":"",
"country / region / city":"Botswana",
"code":"BW",
"users":"1",
"graph":"|",
"percentage":"0.1%",
"sessions":"1"}
,
{
"No.":"",
"flag":"",
"country / region / city":"",
"code":"",
"users":"1,876",
"graph":"",
"percentage":"100%",
"sessions":"2,151"}
]
}

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