Site metrics endpoints

GET /v1/metrics/site

Returns all site metrics between two dates.

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

  • goalId   integer  

    To return conversion metrics for a non-ecommerce goal.

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 93.00790024010534,
"name": "bounceRate",
"currency": "USD"
},
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 186.890756302521,
"name": "cartAverage",
"currency": "USD"
},
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 3649,
"name": "conversionCount",
"currency": "USD"
},
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 7.068828577516902,
"name": "conversionRate",
"currency": "USD"
},
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 1.1468321586244288,
"name": "pageviewAverage",
"currency": "USD"
},
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 22240,
"name": "revenueSum",
"currency": "USD"
},
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 3.1195242041669893,
"name": "sessionTimeAverage",
"currency": "USD"
},
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 51644,
"name": "visits",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/bounce-rate

The ratio between the visitors who entered the site and left it without having seen a second page and all visitors.

More information regarding the metric and how to interpret it…

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 93.00790024010534,
"name": "bounceRate",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/cart-average

The average cart amount is calculated by dividing the total revenue by the number of transactions. This metric is only accessible for “e-commerce” projects.

More information regarding the metric and how to interpret it…

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 186.890756302521,
"name": "cartAverage",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/conversions

The number of sessions where a specified goal was reached. More information regarding the metric and how to interpret it…

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • goalId   integer  

    Required only for non “e-commerce” projects. Goal filter for analysis.
    If not specified for an “e-commerce” project, the API will return data for the “e-commerce” goal.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 3649,
"name": "conversionCount",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/conversion-rate

Ratio between the number of sessions where a specified goal was reached and the total number of sessions. More information regarding the metric and how to interpret it…

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • goalId   integer  

    Required only for non “e-commerce” projects. Goal filter for analysis.
    If not specified for an “e-commerce” project, the API will return data for the “e-commerce” goal.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 7.068828577516902,
"name": "conversionRate",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/pageview-average

Average number page views during a session (a page that has been refreshed counts as one view).

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 1.1468321586244288,
"name": "pageviewAverage",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/revenue

Sum of all the transaction amounts. This metric is only accessible for “e-commerce” projects.

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 22240,
"name": "revenueSum",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/session-time-average

Average time spent from entry on the site to site exit for each visit.

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 3.1195242041669893,
"name": "sessionTimeAverage",
"currency": "USD"
}
]
},
"success": true
}

GET /v1/metrics/site/visits

Number of sessions. More information regarding the metric and how to interpret it…

Query parameters

  • projectId   integer  

    Required only for an account-level API key. The target project.

  • startDate   ISO 8601 date string   Required

    Beginning of date range for analysis. Must be a date prior to endDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • endDate   ISO 8601 date string   Required

    End of date range for analysis. Must be a date after startDate.

    ISO format in UTC (for example “2021-08-13T12:32:40.000Z”) or with a time zone offset (“2021-08-13T12:32:40+02:00” or “2021-08-13T12:32:40%2B+02:00” when encoded in the URL).

  • device   string  

    Device filter for analysis.

    Possible values: all (default), desktop, mobile, or tablet.

  • period   string  

    Granularity of the results. Can only be used on a date range larger then one day. It allows you to have data for each day instead of having a combine result.

    Possible values: none (default), daily.

  • segmentIds   integer  

    Filter analysis with Contentsquare segments. Default: All visitors.
    You can specify multiple segments separated by commas to retrieve the metrics for the intersection of the specified segments

Example of response

{
"payload": {
"values": [
{
"startDate": "2021-07-16T00:00:00.000Z",
"endDate": "2021-07-22T00:00:00.000Z",
"value": 51644,
"name": "visits",
"currency": "USD"
}
]
},
"success": true
}