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 2018-05-20 and three weeks back display:
HTTP GET/ POST:/api/location/top_country_region_city.jsp?date=2018-05-20&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 2018-05-20:
HTTP GET/ POST:/api/location/top_country_region_city.jsp?date=2018-05-20&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 offset formatted as:

{ "resultsList": [
{
"No.":"1",
"flag":"",
"country / region / city":"United Kingdom",
"code":"GB",
"users":"143",
"graph":"||||||||||||||||||||",
"percentage":"27.8%",
"sessions":"148"}
,
{
"No.":"2",
"flag":"",
"country / region / city":"Netherlands",
"code":"NL",
"users":"44",
"graph":"||||||",
"percentage":"8.6%",
"sessions":"46"}
,
{
"No.":"3",
"flag":"",
"country / region / city":"Germany",
"code":"DE",
"users":"43",
"graph":"||||||",
"percentage":"8.4%",
"sessions":"45"}
,
{
"No.":"4",
"flag":"",
"country / region / city":"Italy",
"code":"IT",
"users":"27",
"graph":"||||",
"percentage":"5.3%",
"sessions":"27"}
,
{
"No.":"5",
"flag":"",
"country / region / city":"United States",
"code":"US",
"users":"18",
"graph":"|||",
"percentage":"3.5%",
"sessions":"19"}
,
{
"No.":"6",
"flag":"",
"country / region / city":"Poland",
"code":"PL",
"users":"18",
"graph":"|||",
"percentage":"3.5%",
"sessions":"18"}
,
{
"No.":"7",
"flag":"",
"country / region / city":"Denmark",
"code":"DK",
"users":"13",
"graph":"||",
"percentage":"2.5%",
"sessions":"13"}
,
{
"No.":"8",
"flag":"",
"country / region / city":"Turkey",
"code":"TR",
"users":"12",
"graph":"||",
"percentage":"2.3%",
"sessions":"12"}
,
{
"No.":"9",
"flag":"",
"country / region / city":"Spain",
"code":"ES",
"users":"12",
"graph":"||",
"percentage":"2.3%",
"sessions":"12"}
,
{
"No.":"10",
"flag":"",
"country / region / city":"Greece",
"code":"GR",
"users":"10",
"graph":"|",
"percentage":"1.9%",
"sessions":"10"}
,
{
"No.":"11",
"flag":"",
"country / region / city":"Sweden",
"code":"SE",
"users":"10",
"graph":"|",
"percentage":"1.9%",
"sessions":"10"}
,
{
"No.":"12",
"flag":"",
"country / region / city":"Ireland",
"code":"IE",
"users":"10",
"graph":"|",
"percentage":"1.9%",
"sessions":"10"}
,
{
"No.":"13",
"flag":"",
"country / region / city":"Switzerland",
"code":"CH",
"users":"10",
"graph":"|",
"percentage":"1.9%",
"sessions":"10"}
,
{
"No.":"14",
"flag":"",
"country / region / city":"Czech Republic",
"code":"CZ",
"users":"10",
"graph":"|",
"percentage":"1.9%",
"sessions":"10"}
,
{
"No.":"15",
"flag":"",
"country / region / city":"Norway",
"code":"NO",
"users":"10",
"graph":"|",
"percentage":"1.9%",
"sessions":"10"}
,
{
"No.":"16",
"flag":"",
"country / region / city":"Belgium",
"code":"BE",
"users":"9",
"graph":"|",
"percentage":"1.8%",
"sessions":"9"}
,
{
"No.":"17",
"flag":"",
"country / region / city":"Portugal",
"code":"PT",
"users":"7",
"graph":"|",
"percentage":"1.4%",
"sessions":"8"}
,
{
"No.":"18",
"flag":"",
"country / region / city":"Russian Federation",
"code":"RU",
"users":"7",
"graph":"|",
"percentage":"1.4%",
"sessions":"7"}
,
{
"No.":"19",
"flag":"",
"country / region / city":"France",
"code":"FR",
"users":"7",
"graph":"|",
"percentage":"1.4%",
"sessions":"7"}
,
{
"No.":"20",
"flag":"",
"country / region / city":"Romania",
"code":"RO",
"users":"7",
"graph":"|",
"percentage":"1.4%",
"sessions":"7"}
,
{
"No.":"21",
"flag":"",
"country / region / city":"Israel",
"code":"IL",
"users":"7",
"graph":"|",
"percentage":"1.4%",
"sessions":"7"}
,
{
"No.":"22",
"flag":"",
"country / region / city":"Austria",
"code":"AT",
"users":"6",
"graph":"|",
"percentage":"1.2%",
"sessions":"6"}
,
{
"No.":"23",
"flag":"",
"country / region / city":"Croatia",
"code":"HR",
"users":"6",
"graph":"|",
"percentage":"1.2%",
"sessions":"6"}
,
{
"No.":"24",
"flag":"",
"country / region / city":"India",
"code":"IN",
"users":"5",
"graph":"|",
"percentage":"1.0%",
"sessions":"5"}
,
{
"No.":"25",
"flag":"",
"country / region / city":"Slovenia",
"code":"SI",
"users":"4",
"graph":"|",
"percentage":"0.8%",
"sessions":"4"}
,
{
"No.":"26",
"flag":"",
"country / region / city":"Canada",
"code":"CA",
"users":"4",
"graph":"|",
"percentage":"0.8%",
"sessions":"5"}
,
{
"No.":"27",
"flag":"",
"country / region / city":"Cyprus",
"code":"CY",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"4"}
,
{
"No.":"28",
"flag":"",
"country / region / city":"Luxembourg",
"code":"LU",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"3"}
,
{
"No.":"29",
"flag":"",
"country / region / city":"Ukraine",
"code":"UA",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"3"}
,
{
"No.":"30",
"flag":"",
"country / region / city":"Finland",
"code":"FI",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"3"}
,
{
"No.":"31",
"flag":"",
"country / region / city":"Malta",
"code":"MT",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"3"}
,
{
"No.":"32",
"flag":"",
"country / region / city":"Serbia and Montenegro",
"code":"RS",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"3"}
,
{
"No.":"33",
"flag":"",
"country / region / city":"Slovakia",
"code":"SK",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"3"}
,
{
"No.":"34",
"flag":"",
"country / region / city":"Bulgaria",
"code":"BG",
"users":"3",
"graph":"|",
"percentage":"0.6%",
"sessions":"3"}
,
{
"No.":"35",
"flag":"",
"country / region / city":"Anonymous Proxy",
"code":"A1",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"36",
"flag":"",
"country / region / city":"Malaysia",
"code":"MY",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"3"}
,
{
"No.":"37",
"flag":"",
"country / region / city":"Armenia",
"code":"AM",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"38",
"flag":"",
"country / region / city":"Argentina",
"code":"AR",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"39",
"flag":"",
"country / region / city":"Hungary",
"code":"HU",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"40",
"flag":"",
"country / region / city":"Saudi Arabia",
"code":"SA",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"41",
"flag":"",
"country / region / city":"Jordan",
"code":"JO",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"42",
"flag":"",
"country / region / city":"Lithuania",
"code":"LT",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"43",
"flag":"",
"country / region / city":"Philippines",
"code":"PH",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"44",
"flag":"",
"country / region / city":"Lebanon",
"code":"LB",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"2"}
,
{
"No.":"45",
"flag":"",
"country / region / city":"Indonesia",
"code":"ID",
"users":"2",
"graph":"|",
"percentage":"0.4%",
"sessions":"3"}
,
{
"No.":"46",
"flag":"",
"country / region / city":"Nepal",
"code":"NP",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"1"}
,
{
"No.":"47",
"flag":"",
"country / region / city":"Europe",
"code":"EU",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"1"}
,
{
"No.":"48",
"flag":"",
"country / region / city":"Belarus",
"code":"BY",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"2"}
,
{
"No.":"49",
"flag":"",
"country / region / city":"Macedonia",
"code":"ME",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"1"}
,
{
"No.":"50",
"flag":"",
"country / region / city":"Singapore",
"code":"SG",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"1"}
,
{
"No.":"51",
"flag":"",
"country / region / city":"Hong Kong",
"code":"HK",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"4"}
,
{
"No.":"52",
"flag":"",
"country / region / city":"Pakistan",
"code":"PK",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"1"}
,
{
"No.":"53",
"flag":"",
"country / region / city":"Mexico",
"code":"MX",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"1"}
,
{
"No.":"54",
"flag":"",
"country / region / city":"Australia",
"code":"AU",
"users":"1",
"graph":"|",
"percentage":"0.2%",
"sessions":"1"}
,
{
"No.":"",
"flag":"",
"country / region / city":"",
"code":"",
"users":"514",
"graph":"",
"percentage":"100%",
"sessions":"533"}
]
}

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