Metrics API

The metrics API allows you to get insights into how the integration is performing. The metrics are bucketed in time slices, and split on variables like page_type and version, so you can get detailed insights in how each list or page is performing.

Some of the metrics you can query:

  • clicks: The number of clicks

  • recommendation_sets: The number of sets of recommendations

  • pageviews: Number of pages visited

  • attribution: The attributed revenue

For more information you can find a full overview of our provided metrics here.

Specifications

Get all available metrics.

GET /metrics

Responses

HTTP Code Description Schema

200

OK

Produces

  • application/json

Example HTTP response

Response 200
[
    {
        "fields": [
            {
                "field_name": "environment",
                "field_type": "STRING"
            },
            {
                "field_name": "user_group",
                "field_type": "STRING"
            },
            {
                "field_name": "channel",
                "field_type": "STRING"
            },
            {
                "field_name": "start_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "end_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "page_type",
                "field_type": "STRING"
            },
            {
                "field_name": "list_name",
                "field_type": "STRING"
            },
            {
                "field_name": "count",
                "field_type": "INT64"
            }
        ],
        "metric_name": "clicks"
    },
    {
        "fields": [
            {
                "field_name": "environment",
                "field_type": "STRING"
            },
            {
                "field_name": "user_group",
                "field_type": "STRING"
            },
            {
                "field_name": "channel",
                "field_type": "STRING"
            },
            {
                "field_name": "start_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "end_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "page_type",
                "field_type": "STRING"
            },
            {
                "field_name": "count",
                "field_type": "INT64"
            }
        ],
        "metric_name": "requests"
    },
    {
        "fields": [
            {
                "field_name": "environment",
                "field_type": "STRING"
            },
            {
                "field_name": "user_group",
                "field_type": "STRING"
            },
            {
                "field_name": "channel",
                "field_type": "STRING"
            },
            {
                "field_name": "start_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "end_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "page_type",
                "field_type": "STRING"
            },
            {
                "field_name": "count",
                "field_type": "INT64"
            }
        ],
        "metric_name": "pageviews"
    },
    {
        "fields": [
            {
                "field_name": "environment",
                "field_type": "STRING"
            },
            {
                "field_name": "user_group",
                "field_type": "STRING"
            },
            {
                "field_name": "channel",
                "field_type": "STRING"
            },
            {
                "field_name": "start_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "end_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "page_type",
                "field_type": "STRING"
            },
            {
                "field_name": "item_id",
                "field_type": "STRING"
            },
            {
                "field_name": "list_name",
                "field_type": "STRING"
            },
            {
                "field_name": "count",
                "field_type": "INT64"
            }
        ],
        "metric_name": "recommendations_per_item"
    },
    {
        "fields": [
            {
                "field_name": "environment",
                "field_type": "STRING"
            },
            {
                "field_name": "user_group",
                "field_type": "STRING"
            },
            {
                "field_name": "channel",
                "field_type": "STRING"
            },
            {
                "field_name": "start_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "end_time",
                "field_type": "TIMESTAMP"
            },
            {
                "field_name": "page_type",
                "field_type": "STRING"
            },
            {
                "field_name": "item_id",
                "field_type": "STRING"
            },
            {
                "field_name": "list_name",
                "field_type": "STRING"
            },
            {
                "field_name": "count",
                "field_type": "INT64"
            }
        ],
        "metric_name": "clicks_per_item"
    }
]

cURL Example

$ curl --location --request GET 'https://{subdomain}.froomle.com/api/metrics' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer X'

Get the data from metric.

GET /metrics/{metric}

Parameters

Type Name Description Schema Default

Path

metric
required

The metric to query, for a list of queryable metrics, see metrics/

string

Query

ascending
optional

A boolean to indicate if the sorting should happen ascending or descending.

boolean

"true"

Query

environment
optional

The environment for which to fetch metrics, if left empty all environments will be used

string

Query

limit
optional

The limit on the number of response values to give.

integer

Query

orderby
optional

The field to order by in the response, these fields need to be present in the queried metric

string

"start_time"

Query

start_time
optional

Range query to select the time frame for which to request data. Allowed fields are gte and lt. Values should be ISO timestamps, with no minutes nor seconds. If gte and lt properties are equal, no data will be returned.

object

Responses

HTTP Code Description Schema

200

OK

400

Error in the query parameters

No Content

404

Metric not found

No Content

500

Error in processing the query

No Content

Produces

  • application/json

Example HTTP response

Response 200
{
    "nr_results": 3,
    "parameters": {
        "ascending": true,
        "environment": "{environment}",
        "limit": 1000,
        "orderby": "start_time",
        "start_time": {
            "gte": "2021-05-18T11:00:00+00:00",
            "lt": "2021-05-18T12:00:00+00:00"
        }
    },
    "results": [
        {
            "channel": "www-desktop",
            "count": 10,
            "end_time": "2021-05-18T12:00:00+00:00",
            "environment": "{environment}",
            "page_type": "article_detail",
            "start_time": "2021-05-18T11:00:00+00:00",
            "user_group": "froomle"
        },
        {
            "channel": "www-desktop",
            "count": 6,
            "end_time": "2021-05-18T12:00:00+00:00",
            "environment": "{environment}",
            "page_type": "article_detail",
            "start_time": "2021-05-18T11:00:00+00:00",
            "user_group": "froomle"
        },
        {
            "channel": "www-desktop",
            "count": 3,
            "end_time": "2021-05-18T12:00:00+00:00",
            "environment": "{environment}",
            "page_type": "article_detail",
            "start_time": "2021-05-18T11:00:00+00:00",
            "user_group": "froomle"
        }
    ],
    "total_nr_results": 3
}

cURL Example

$ curl --location --request GET 'https://{subdomain}.froomle.com/api/metrics/{metric}?environment={environment}&start_time[gte]=2021-10-01T00:00:00Z&start_time[lt]=2021-10-02T00:00:00Z'' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer X'

Definitions

FieldInfo

Name Schema

field_name
optional

string

field_type
optional

string

MetricInfo

Name Description Schema

fields
optional

< FieldInfo > array

metric_name
optional

Example : "clicks"

string

MetricList

Type : < MetricInfo > array

MetricOutput

Name Description Schema

nr_results
optional

The number of results in the results list
Example : 1

integer

query_params
optional

This will echo the parameters from the query.

results
optional

total_nr_results
optional

The total number of results that could be found in the results set
Example : 1

integer

query_params

Name Description Schema

ascending
optional

Example : true

boolean

environment
optional

string

limit
optional

Example : 1000

integer

orderby
optional

Example : "time"

string

start_time
optional

start_time

Name Description Schema

gte
optional

ISO timestamp, with 00:00 for minutes, seconds.
Example : "2020-04-01T00:00:00Z"

string

lt
optional

ISO timestamp, with 00:00 for minutes, seconds.
Example : "2020-05-01T00:00:00Z"

string

MetricResult

Name Description Schema

start_time
required

the start of the interval for which this is the value

integer

value
required

the value of the metric

number

MetricResults

Type : < MetricResult > array