Stetic API

Version: 1.3 - Date: 20.06.2017

Query API




Mit Hilfe der Stetic-Query-API können Sie Daten aus Stetic abfragen und lesen. Unsere API beinhaltet alle Daten der wichtigsten Funktionen von Stetic.

All data is provided in JSON format and will contain a object with the name "results". Are multiple records provided, this object contains an array with the name of "items".
Unless otherwise noted, requests to the API are expected via HTTP GET, parameters must be provided as GET parameters.

Examples for accessing the Stetic API

Often it is easier to start accessing an API with some code samples.
We have here some examples for you. Examples in other languages will follow.

Standard Parameters

The following parameters are required for all functions, unless otherwise specified.

Parameter


Parameter Description Format Example
token Token of desired project.
If empty, pid must be specified.
String XXXX-123456789012-XXXXXXXX
pid ID of desired project
If empty, token must be specified.
String 12345
apikey API key of project. String XXXXXXX-XXXXXXX-XXXXXXX

Optional parameters

The following parameters are optionally available for all functions.


Parameter Description Format Example
date_from Start date of the query. String - YYYY-MM-DD 2015-01-05
date_to End date of the query. String - YYYY-MM-DD 2015-02-05
limit Number of returned records. (Max. 500) Integer 25

API Functions



Events

https://www.stetic.com/api/events/

Liefert Daten für Events.

Achtung! Diese API ist eine Live-Abfrage. Wir empfehlen, die Abfrage unbedingt auf ein bestimmtes Event und einen kleineren Zeitraum, wie z.B. 1 Tag, einzugrenzen.

Diese API ist auf maximal 1 Abfrage pro Minute limitiert.
(Stand: 16.04.2018)


Parameter


event
String
optional
Das Event, für welches Sie Daten auslesen möchten.
Wird kein Event angegeben, werden alle Events zurück gegeben.
where
Array
optional
Abfrage auf Event-Properties.
Property als Array-Key, als Wert ein Array mit folgenden Attributen:
op
String
optional
Mögliche Werte:
equals = ist gleich
contains = enthällt
begins = beginnt mit
ends = endet mit
value
String
required
Wert der Abfrage.
Beispiel als Query-String:
where[url][op]=contains&where[url][value]=mobile&where[user.language][value]=de
property
String
optional
Der Schlüssel einer Property, nach der die Daten gruppiert werden sollen.
date_from
String (YYYY-MM-DD)
optional
Start date of the query.
date_to
String (YYYY-MM-DD)
optional
End date of the query.
unit
String
optional
Zeiteinheit in der das Ergebnis zurück geliefert wird.
Mögliche Werte: day, week, month, year. Standard: day

Return values


cohorts Nach Event und Datum gruppierte Werte.
cohorts.[event].[date].count Anzahl des Events.
cohorts.[event].[date].ucount Anzahl eindeutiger Besucher mit diesem Event.
properties Die Schlüssel der gefundenen Properties bzw. Attribute.

Example URL:
https://www.stetic.com/api/events/?event=appview&date_from=2016-08-17&date_to=2016-08-20

Example response:

{"results":{"cohorts":{"all":{"2016-08-17":{"count":409,"ucount":11},"2016-08-18":{"count":397,"ucount":17},"2016-08-19":{"count":601,"ucount":19},"2016-08-20":{"count":139,"ucount":9},"total":{"count":1546,"ucount":26}}},"properties":["$app","$app_version","$carrier","$device_model","$fs_lib","$os","$os_version","$view","$project", "$user.id", "$user.email", "$user.company"]}}




Dashboard

https://www.stetic.com/api/dashboard/{metric1},{metric2},{metric3}

Provides all important metrics for Web Analytics. The desired metrics can be selected by the third part of the URL path. The declaration of 'date_from' and 'date_to' is not possible due to the predefined times.

Example URL:
https://www.stetic.com/api/dashboard/visits_today,hits_today,user_online

Metrics and return values


visitors_today Visitors count today
visitors_yesterday Visitors count yesterday
visitors_yth Number of visitors yesterday until the current hour
visitors_yth_percent Percent visitors yesterday until the current hour
visitors_thismonth Visitors count current month
visitors_lastmonth Visitors count last month
visitors_thisyear Visitors count current year
visitors_total Visitors count total
visits_today Visits count today
visits_yesterday Visits count yesterday
visits_yth Number of visits yesterday until the current hour
visits_yth_percent Percent visits yesterday until the current hour
visits_thismonth Visits count current month
visits_lastmonth Visits count last month
visits_thisyear Visits count current year
visits_total Visits count total
ret_visits_today Number of returning visitors current day
ret_visits_yesterday Returning Visitors count yesterday
ret_visits_thismonth Returning Visitors count current month
ret_visits_lastmonth Number of returning visitors last month
ret_visits_thisyear Number of returning visitors current year
ret_visits_total Number of returning visitors total
hits_today Page views current day
hits_yesterday Page views yesterday
hits_yth Number of pageviews yesterday until the current hour
hits_yth_percent Percent pageviews yesterday until the current hour
hits_thismonth Page views current month
hits_lastmonth Page views last month
hits_thisyear Page views current year
hits_total Page views total
hits_per_visit_today Pageviews per Visitor current day
hits_per_visit_yesterday Pageviews per Visitor yesterday
hits_per_visit_thismonth Pageviews per Visitor current month
hits_per_visit_lastmonth Pageviews per Visitor last month
hits_per_visit_thisyear Pageviews per Visitor current year
hits_per_visit_total Pageviews per Visitor total
avg_time_today Average time on site in minutes today
avg_time_yesterday Average time on site in minutes yesterday
avg_time_thismonth Average time on site in minutes current month
avg_time_lastmonth Average time on site in minutes last month
avg_time_thisyear Average time on site in minutes current year
avg_time_total Average time on site in minutes total
avg_atime_today Average activity time in minutes today
avg_atime_yesterday Average activity time in minutes yesterday
avg_atime_thismonth Average activity time in minutes current month
avg_atime_lastmonth Average activity time in minutes last month
avg_atime_thisyear Average activity time in minutes current year
avg_atime_total Average activity time in minutes total
conversions_today Conversions today
conversions_yesterday Conversions yesterday
conversions_yth Conversions yesterday until the current hour
conversions_yth_percent Percent of conversions until the current hour
conversion_rate_today Conversion rate today
bounce_rate_today Bounce rate today
user_online Number of visitors currently online on website

Example response:

{"results":{"visits_today":"375","visits_yesterday":"1045","visits_yth":"318","visits_yth_percent":"9.12","visits_thismonth":"4294","avg_time_today":"8:37","avg_atime_today":"01:04","conversions_today":"123","user_online":"23"}}



Numbers

https://www.stetic.com/api/numbers

Provides visitors, returning visitors, page views in a certain period of time.


Additional parameters
year Year. Format: yyyy
mon Month and Year. Format: mm-yyyy (Month without leading zero)
day Day. Format: dd
from Start date for the query of a specific period of time. Format: yyyy-mm-dd
to End date for the query of a specific period of time. Format: yyyy-mm-dd

Query modes
Mode Needed parameters Return
Year year Provides the numbers for each month for the given year.
Month mon Provides the numbers for each day for the given month.
Day mon, day Provides the numbers for each hour for the given day.
Period of time from, to Provides the numbers for each day for the given period of time.

Return values


name Description depending on the query mode: date, month, or hour
v Number of visitors
rv Number of returning visitors
h Number of page views
e Number of events

Example response:

{"results":{"items":[{"name":"01.08.2011","v":"1277","rv":"856","h":"13174","e":"1815"},{"name":"02.08.2011","v":"1310","rv":"883","h":"12807","e":"2054"},{"name":"03.08.2011","v":"1245","rv":"800","h":"12703","e":"2336"}]}}



Sites

https://www.stetic.com/api/sites

Provides the TOP pages, sorted by page views descending. Limited to 100 records.

Example URL:
https://www.stetic.com/api/sites/

Return values


name Name or URL of page
count Number of page views
visits Number of visits
time Average time on site in seconds
atime Average activity time in seconds
ltime Average load time in milliseconds
bounce Bounce rate

Example response:

{"results":{"items":[{"name":"\/page.html","count":"50861","visits":"12971","time":"123","atime":"87","ltime":"189","bounce":"10"},{"name":"\/","count":"36645","visits":"10918","time":"156","atime":"92","ltime":"171","bounce":"20"},{"name":"\/page-2.html","count":"12217","visits":"8812","time":"54","atime":"20","ltime":"126","bounce":"17"}]}}



Site

https://www.stetic.com/api/site?path={path_of_site}

Returns the statistics for a single page.

Example URL:
https://www.stetic.com/api/site/?path=/


Additional required parameters
path Path of the page. Example: /index.html

Return values


id ID of the page
title Title of page
path Path / URL of page
count Number of page views
visits Number of visits
time Average time on site in seconds
atime Average activity time in seconds
ltime Average load time in milliseconds
bounce Bounce rate
encount Number of entry
excount Number of bounces
sp10 Number of visitors that have scrolled 10% of the page.
st10 Average time visitors need to scroll down 10% of the page.
sp25 Number of visitors that have scrolled 25% of the page.
st25 Average time visitors need to scroll down 25% of the page.
sp50 Number of visitors that have scrolled 50% of the page.
st50 Average time visitors need to scroll down 50% of the page.
sp75 Number of visitors that have scrolled 75% of the page.
st75 Average time visitors need to scroll down 75% of the page.
sp100 Number of visitors, that have scrolled 100% of the page.
st100 Average time visitors need to scroll down 100% of the page.

Example response:

{"results":{"id":"1","path":"\/","title":"Startseite","count":"9921","visits":"8234","time":"286","atime":"28","ltime":"165.85","bounce":"17.3066","encount":"7344","excount":"2300","sp10":"442","st10":"148","sp25":"387","st25":"43","sp50":"315","st50":"68","sp75":"274","st75":"135","sp100":"186","st100":"173"}}



Sites_entry

https://www.stetic.com/api/sites_entry

Provides the TOP entry pages, sorted by page views descending. Limited to 100 records.


Return values


name Name or URL of page
count Number of page views

Example response:

{"results":{"items":[{"name":"\/landingpage.html","count":"30163"},{"name":"\/landingpage-2.html","count":"25647"},{"name":"\/landingpage-3.html","count":"19943"}]}}



Sites_exit

https://www.stetic.com/api/sites_exit

Provides the TOP exit pages, sorted by page views descending. Limited to 100 records.


Return values


name Name or URL of page
count Number of page views

Example response:

{"results":{"items":[{"name":"\/page.html","count":"30163"},{"name":"\/page-2.html","count":"25647"},{"name":"\/page-3.html","count":"19943"}]}}



Referrer

https://www.stetic.com/api/referrer

Provides the TOP referers, sorted by count descending. Limited to 100 records.


Return values


name Domain of the referer
count Number of visitors with this referer

Example response:

{"results":{"items":[{"name":"www.google.com","count":"11446"},{"name":"www.google.de","count":"8273"},{"name":"www.facebook.com","count":"7168"},{"name":"t.co","count":"6853"}]}}



Browser

https://www.stetic.com/api/browser

Provides the TOP browsers, sorted by count descending. Limited to 50 records.


Return values


name Domain of the browser
count Number of visitors with this browser
percent Percent of the visitors with this browser

Example response:

{"results":{"items":[{"name":"Firefox","percent":"43.23","count":"11540"},{"name":"Google Chrome","percent":"19.11","count":"5103"},{"name":"Internet Explorer","percent":"13.79","count":"3682"}]}}



Keywords

https://www.stetic.com/api/keywords

Provides the TOP search keywords, sorted by count descending. Limited to 50 records.


Return values


name Keyword
count Number of visitors with this keyword
percent Percent of the visiors with this keyword
pos Current position of your web page in the Google rankings
We evaluate the Google referer URL which contains the position in some cases.

Example response:

{"results":{"items":[{"name":"keyword","count":"31142","percent":"12.09","pos":"1"},{"name":"long tail keyword","count":"25318","percent":"11.49","pos":"2"},{"name":"another keyword","count":"24615","percent":"11.30","pos":"1"}]}}



Search_engines

https://www.stetic.com/api/search_engines

Provides the TOP search engines, sorted by count descending. Limited to 50 records.


Return values


name Search engine
count Number of visitors with this search engine
percent Percent of the visiors with this search engine

Example response:

{"results":{"items":[{"name":"Google","count":"28871","percent":"95.23"},{"name":"Bing.com","count":"709","percent":"2.34"},{"name":"Duckduckgo.com","count":"545","percent":"1.8"}]}}



Os

https://www.stetic.com/api/os

Provides the TOP operating systems, sorted by count descending. Limited to 50 records.


Return values


name Operating system
count Number of visitors with this operating system
percent Percent of the visiors with this operating system

Example response:

{"results":{"items":[{"name":"Windows 7","percent":"44.76","count":"11954"},{"name":"iOS","percent":"13.30","count":"3552"},{"name":"Windows 8.1","percent":"12.64","count":"3375"}]}}



Screen

https://www.stetic.com/api/screen

Provides the TOP screen resolutions, sorted by count descending. Limited to 50 records.


Return values


name Screen resolutions in pixel
count Number of visitors with this screen resolution
percent Percent of the visiors with this screen resolution

Example response:

{"results":{"items":[{"name":"1920x1080","percent":"19.27","count":"5106"},{"name":"1680x1050","percent":"9.11","count":"2414"},{"name":"1366x768","percent":"8.58","count":"2274"}]}}



Countries

https://www.stetic.com/api/countries

Provides the TOP countries, sorted by count descending. Limited to 50 records.


Return values


name Country
code ISO 3166 Country code
count Number of visitors from this country
percent Percent of the visiors from this country

Example response:

{"results":{"items":[{"name":"Germany","code":"de","count":"22110","percent":"82.81"},{"name":"Austria","code":"at","count":"1192","percent":"4.46"},{"name":"Switzerland","code":"ch","count":"673","percent":"2.52"}]}}



Downloads

https://www.stetic.com/api/downloads

Provides the TOP downloads, sorted by count descending. Limited to 50 records.


Return values


name Download URL
count Downloads count

Example response:

{"results":{"items":[{"name":"\/path\/to\/Download.pdf","count":"3812"},{"name":"\/path\/to\/Download-2.pdf","count":"2963"},{"name":"\/path\/to\/Download-3.pdf","count":"2757"}]}}



Links

https://www.stetic.com/api/links

Provides the TOP external links, sorted by count descending. Limited to 50 records.


Return values


name URL of the link
count Click count

Example response:

{"results":{"items":[{"name":"http:\/\/www.domain.com\/site\/index.html","count":"8149"},{"name":"https:\/\/www.google.de\/","count":"6159"},{"name":"http:\/\/www.adomain.io\/topic\/","count":"6032"}]}}



Visitor_log

https://www.stetic.com/api/visitor_log

Provides the data of the last visitors of your web page, sorted by date und time descending. Limited to 50 records.


Return values


ip IP address
host Hostname of the IP Address
referrer Referer
os Operating system
browser Browser
screen Screen resolution
js Javascript enabled (1=yes, 0=no)
cookies Cookies enabled (1=yes, 0=no)
geo Description of Geo location, if available. Country, state/province, city.
lat Latitude
lon Longitude
entry Entry page
hits Number of page views
time Date and Time of last request. Format: yyyy-mm-dd hh:ii:ss
time_entry Date and Time of first request. Format: yyyy-mm-dd hh:ii:ss
duration Time on site in seconds
kw Keyword
kwpos Current position of your web page in the Google rankings
We evaluate the Google referer URL which contains the position in some cases.

Example response:

{"results":{"items":[{"ip":"12.34.56.*","host":"12.34.56.*","referrer":"https:\/\/www.google.com\/","os":"Windows 7","browser":"Firefox 35.0","screen":"1280x720","js":"1","cookies":"1","geo":"Berlin, Germany","lat":"52.520007","lon":"13.404954","entry":"\/index.html","exit":"\/page.html","hits":"18","duration":"328","time":"2013-11-15 12:05:12","time_entry":"2013-11-15 12:03:30","kw":"a keyword","kwpos":"3"}]}}



Useronline

https://www.stetic.com/api/useronline

Provides the number of visitors who are currently online on your web page.


Return values


user_online Number of visitors currently online on website

Example response:

{"results":{"user_online":"384"}}



Ecommerce

https://www.stetic.com/api/ecommerce

Metrics for Ecommerce.


Additional parameters
unit Unit for grouping the results. 'day', 'hour' or 'sum'.

Return values


caption Description. Depending on unit.
revenue Revenue
quantity Quantity
transactions Transactions / number of orders.
sessions Number of unique sessions that have resulted in a transaction.
visits Total number of visits.
conv_rate Conversion rate
cart_val Total cart value.
cart_qty Total cart quantity.
cart_sess Total cart sessions.
cart_abs Shopping cart abandonments
cart_abt_rate Shopping cart abandonment rate
ttc Time to basket (seconds).
tto Time to order (seconds).

Example response:

{"results":{"unit":"day","date_from":"2014-08-01","date_to":"2014-11-01","items":[{"caption":"2014-11-01","revenue":1050,"quantity":3,"transactions":1,"sessions":1,"avg_rev":1050,"visits":1,"conv_rate":100,"cart_val":1050,"cart_qty":3,"cart_sess":1,"cart_abs":0,"cart_abt_rate":0,"ttc":70,"tto":237}]}}


Projects

https://www.stetic.com/api/projects?login={login}&password={password}

Provides a list with all projects from a account.


Parameter


login Your Stetic User name
password Your Stetic password

Return values


id Project-ID
token Projekt-Token
name Name of the project
domain Domain of the project
std Standard project, 1 = yes / 0 = no
key API-Key

Example response:

{"results":{
  "items":[{
    "id":"123",
    "token":"XXXX-123456789012-XXXXXXXX",
    "name":"My project",
    "domain":"www.project.xy",
    "std":"1",
    "key":"xxxxxxx-xxxxxxx-xxxxxxx"
  },
  {
    "id":"456",
    "token":"XXXX-234567890123-XXXXXXXX",
    "name":"Another project",
    "domain":"www.another-project.xy",
    "std":"0",
    "key":"xxxxxxx-xxxxxxx-xxxxxxx"
  }]
}}



Project - Create

Method: POST

https://www.stetic.com/api/project/create?login={login}&password={password}

Adds a new project


GET-Parameter


login Your Stetic User name
password Your Stetic password

POST-Parameter


name Name of the project
domain Domain of the project

Return values


result Success message or "Error" on failure
id ID of the new project
token Token of the new project
key API key of the new project
error Error message if result = "Error"

Example response:

{"results":{
  "result":"Project saved successfully.",
  "id":12345,
  "token":"XXXX-123456789012-XXXXXXXX",
  "key":xxxxxxx-xxxxxxx-xxxxxxx,
}}



Project - Update

Method: POST

https://www.stetic.com/api/project/update?token={token}&apikey={apikey}

Changes the project data
For this method is - unlike at create - project token and the API key required.


POST-Parameter


id ID des Projektes
name Name of the project
domain Domain of the project

Return values


result Success message or "Error" on failure
error Error message if result = "Error"

Example response:

{"results":{
  "result":"Project saved successfully."
}}



Project - Htmlcode

Method: POST

https://www.stetic.com/api/project/htmlcode

Returns the tracking code of the selected project.


Return values


htmlcode Tracking code Base64 encoded.

Example response:

{"results":{
  "htmlcode":"PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPgp2YXIgX2Zzcz1fZnNzfHx7fTsgX2Zzcy50b2tlbiA9ICdYWFhYLTA5ODc2NTQzMjEyMy1YWFhYWFhYWCc7CihmdW5jdGlvbigpe3ZhciBlPSJzdGV0aWMiLGE9d2luZG93LGM9WyJ0cmFjayIsImlkZW50aWZ5IiwiY29uZmlnIiwic2V0IiwidW5zZXQiLCJyZWdpc3RlciIsInVucmVnaXN0ZXIiLCJpbmNyZW1lbnQiLCJhbGlhcyJdLGI9ZnVuY3Rpb24oKXt2YXIgZD0wLGY9dGhpcztmb3IoZi5fZnM9W10sZD0wO2MubGVuZ3RoPmQ7ZCsrKXsoZnVuY3Rpb24oail7ZltqXT1mdW5jdGlvbigpe3JldHVybiBmLl9mcy5wdXNoKFtqXS5jb25jYXQoQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLDApKSksZn19KShjW2RdKX19O2FbZV09YVtlXXx8bmV3IGI7YS5mb3Vyc3RhdHM9YS5mb3Vyc3RhdHN8fG5ldyBiO3ZhciBpPWRvY3VtZW50O3ZhciBoPWkuY3JlYXRlRWxlbWVudCgic2NyaXB0Iik7aC50eXBlPSJ0ZXh0L2phdmFzY3JpcHQiO2guYXN5bmM9dHJ1ZTtoLnNyYz0iLy9zdGV0aWMuY29tL3QuanMiO3ZhciBnPWkuZ2V0RWxlbWVudHNCeVRhZ05hbWUoInNjcmlwdCIpWzBdO2cucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUoaCxnKX0pKCk7Cjwvc2NyaXB0Pg=="
}}