Trends

Display and analyze trends in website traffic through time.

Display and analyze trends in website traffic through time.

API Usage

This API produces a json array. Use this URL to perform GET or POST requests.

Parameters

At least one of the following parameters are required:

date Calculate trends from specified date entered as yyyy-MM-dd. Default is the current date.
unixTime Calculate trends from specified unix timestamp. Default is current unix timestamp.
period Specify the trend period.

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

timezone The timezone used. Use this option if more than one timezone is being recorded, by default the site's defined timezone is used.
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. The 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.
dataType The dataType parameter determines the format of the data returned. Values can be [ json ] | html | jsondatatable | jsonjqgrid | csv | svg | png.
dateFormat The dateFormat parameter determines the format of dates returned. An example is dateFormat=yyyy-dd-MM. The syntax can be found here.

Examples

To calculate the daily trends to the website www.opentracker.net for the user "demo@opentracker.net" with password "demo123":
HTTP GET/ POST: trends.jsp?login=demo@opentracker.net&password=demo123&site=www.opentracker.net&period=1d

To calculate the weekly trends of the week where the date 2024-04-26 falls and display in html:
HTTP GET/ POST:trends.jsp?period=1w&date=2024-04-26&dataType=html

To calculate the monthly trends over a range of 3 months from now/ current month:
HTTP GET/ POST:trends.jsp?period=3m

Response

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

{ "resultsList": [
{
"No.":"3",
"date":"Apr, 2024",
"sessions":"111,628",
"visitors":"91,943",
"first time visitors":"73,334",
"returning":"18,609",
"referred":"64,177",
"searching":"61,886",
"exit link":"366",
"pageviews":"277,180",
"end date":"2024-04-28",
"segment":"",
"single event sessions":"44,610",
"total duration all sessions":"9,750,039",
"start date":"2024-04-01",
"sessionsWithMoreThanOneEvent":""}
,
{
"No.":"2",
"date":"Mar, 2024",
"sessions":"127,341",
"visitors":"105,012",
"first time visitors":"83,383",
"returning":"21,629",
"referred":"75,422",
"searching":"71,864",
"exit link":"441",
"pageviews":"320,473",
"end date":"2024-03-31",
"segment":"",
"single event sessions":"49,594",
"total duration all sessions":"10,950,094",
"start date":"2024-03-01",
"sessionsWithMoreThanOneEvent":""}
,
{
"No.":"1",
"date":"Feb, 2024",
"sessions":"133,986",
"visitors":"112,073",
"first time visitors":"91,206",
"returning":"20,867",
"referred":"78,372",
"searching":"73,217",
"exit link":"487",
"pageviews":"335,907",
"end date":"2024-02-29",
"segment":"",
"single event sessions":"55,403",
"total duration all sessions":"11,597,041",
"start date":"2024-02-01",
"sessionsWithMoreThanOneEvent":""}
,
{
"No.":"",
"date":"",
"sessions":"372,955",
"visitors":"309,028",
"first time visitors":"247,923",
"returning":"61,105",
"referred":"217,971",
"searching":"206,967",
"exit link":"1,294",
"pageviews":"933,560",
"single event sessions":"149,607",
"total duration all sessions":"32,297,174",
"end date":"",
"segment":"",
"start date":"",
"sessionsWithMoreThanOneEvent":""}
]
}

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