Analytics › Get the traffic figures
Analytics
Get the traffic figures
GET/api/{ORG}/analytics/statsPermalink
Answers the AnalyticsFigures.
- Permission
- Analytics · view
- Plan
- Plans that include the API: Pricing
- Retry
- Safe: a read changes nothing
Example request
curl "https://console.brevily.com/api/NORTHWIND/analytics/stats" \ -H "x-api-key: brv_ak_7Fq2Lw9xK3" \ -H "x-api-secret: $BREVILY_SECRET"const res = await fetch("https://console.brevily.com/api/NORTHWIND/analytics/stats", { headers: { "x-api-key": "brv_ak_7Fq2Lw9xK3", "x-api-secret": process.env.BREVILY_SECRET, },});const answer = await res.json();Example answer
{ "days": 1, "history": 1, "from": "example", "to": "example", "zone": "example", "clicks": { "value": 1, "change": { "current": 1, "previous": 1 } }, "uniqueVisitors": { "value": 1, "change": { "current": 1, "previous": 1 } }, "qrScans": { "value": 1, "change": { "current": 1, "previous": 1 } }, "linksClicked": { "value": 1, "change": { "current": 1, "previous": 1 } }}{ "code": "VALIDATION_FAILED", "message": "Check the form. range: Not a value this field takes.", "details": { "fields": { "range": "Not a value this field takes." } }, "requestId": "18188559082372202519"}Made-up values.
PathPermalink
| Name | Type | Required | Description | Allowed values |
|---|---|---|---|---|
ORG | string | required | Your organisation’s code. | — |
QueryPermalink
| Name | Type | Required | Description | Allowed values |
|---|---|---|---|---|
range | string | optional | Narrows the answer: ?range=<value>, or ?range=eq:<value>. | — |
link | string | optional | Narrows the answer: ?link=<value>, or ?link=eq:<value>. | — |
domain | string | optional | Narrows the answer: ?domain=<value>, or ?domain=eq:<value>. | — |
compare | string | optional | Narrows the answer: ?compare=<value>, or ?compare=eq:<value>. | — |
tag | string | optional | Narrows the answer: ?tag=<value>, or ?tag=eq:<value>. | — |
folder | string | optional | Narrows the answer: ?folder=<value>, or ?folder=eq:<value>. | — |
app | string | optional | Narrows the answer: ?app=<value>, or ?app=eq:<value>. | — |
by | string | optional | Narrows the answer: ?by=<value>, or ?by=eq:<value>. | — |
month | string | optional | Narrows the answer: ?month=<value>, or ?month=eq:<value>. | — |
day | string | optional | Narrows the answer: ?day=<value>, or ?day=eq:<value>. | — |
campaign | string | optional | Narrows the answer: ?campaign=<value>, or ?campaign=eq:<value>. | — |
source | string | optional | Narrows the answer: ?source=<value>, or ?source=eq:<value>. | — |
medium | string | optional | Narrows the answer: ?medium=<value>, or ?medium=eq:<value>. | — |
q | string | optional | A search term. | — |
AnswerPermalink
AnalyticsFigures
| Name | Type | Description | Allowed values |
|---|---|---|---|
days | integer | The days reported, in the organisation’s time zone: the range asked for, cut to what the plan keeps (0: it keeps none). | — |
history | integer | The days of daily totals the plan keeps; null for unlimited. | or null |
from | string | The first day, YYYY-MM-DD (the organisation’s time zone). | — |
to | string | The last day, YYYY-MM-DD (the organisation’s time zone), today. | — |
zone | string | The IANA time zone the days are counted in: the organisation’s, or UTC when it set none. | — |
clicks | Figure | Human clicks. | — |
uniqueVisitors | Figure | Unique visitors, summed per link per day. | — |
qrScans | Figure | Of the clicks, QR scans. | — |
linksClicked | Figure | Links clicked at least once. | — |
Fields of clicks
| Name | Type | Description | Allowed values |
|---|---|---|---|
value | integer | Over the whole range, today included. | — |
change | Change | What a change is measured on; null when the plan keeps no days before the range, or the range has no finished day. | or null |
Fields of clicks.change
| Name | Type | Description | Allowed values |
|---|---|---|---|
current | integer | The range’s finished days. | — |
previous | integer | As many days before them. | — |
Fields of uniqueVisitors
| Name | Type | Description | Allowed values |
|---|---|---|---|
value | integer | Over the whole range, today included. | — |
change | Change | What a change is measured on; null when the plan keeps no days before the range, or the range has no finished day. | or null |
Fields of uniqueVisitors.change
| Name | Type | Description | Allowed values |
|---|---|---|---|
current | integer | The range’s finished days. | — |
previous | integer | As many days before them. | — |
Fields of qrScans
| Name | Type | Description | Allowed values |
|---|---|---|---|
value | integer | Over the whole range, today included. | — |
change | Change | What a change is measured on; null when the plan keeps no days before the range, or the range has no finished day. | or null |
Fields of qrScans.change
| Name | Type | Description | Allowed values |
|---|---|---|---|
current | integer | The range’s finished days. | — |
previous | integer | As many days before them. | — |
Fields of linksClicked
| Name | Type | Description | Allowed values |
|---|---|---|---|
value | integer | Over the whole range, today included. | — |
change | Change | What a change is measured on; null when the plan keeps no days before the range, or the range has no finished day. | or null |
Fields of linksClicked.change
| Name | Type | Description | Allowed values |
|---|---|---|---|
current | integer | The range’s finished days. | — |
previous | integer | As many days before them. | — |
ErrorsPermalink
| Status | Code | When |
|---|---|---|
| 400 | VALIDATION_FAILED |
A field, a parameter or the body is wrong; details.fields says which. |
| 401 | UNAUTHENTICATED |
No key, a key that does not match, or one expired or revoked. |
| 403 | ACCESS_DENIED |
The key lacks Analytics · view, or the organisation’s plan does not include it. |
| 404 | NOT_FOUND |
No organisation with that code for this key, or no such record in it. |
| 429 | RATE_LIMITED |
Too many calls: wait Retry-After seconds. |
Rate limitsPermalink
Counted with every other call of the organisation, by plan: Pricing. The answer carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset; more on rate limits.
Type a call, a field or a guide.