Skip to main content

Widget Analytics

Endpoint GET /widget/:id/analytics

Retrieve engagement analytics for a widget.

This endpoint provides detailed analytics for individual widgets, offering insights into user engagement and interaction patterns.

Data Freshness

Please note that analytics are compiled into daily reports. Consequently, live data might not be available on the same day. For the most up-to-date information, consider checking analytics a day after the desired period.

Path Parameters

Required
  • id - The widget's id.

Query Parameters

Optional
  • from - The start date of the analytics period. Format: YYYY-MM-DD (default: 7 days back).
  • to - The end date of the analytics period. Format: YYYY-MM-DD (default: today).
  • breakdown - The breakdown of the analytics. Possible values: day, week, month (default: day).
  • events - The events to include in the analytics, comma separated. Possible values: widget-load, widget-view, etc. (default will return all events).
Event Types Per Widget

Each widget has its own set of event types. To view a comprehensive list of widgets and their corresponding events, please refer to Widget Events reference.

Example Request:

curl -H "Authorization: Bearer ACCESS_TOKEN" "https://api.commoninja.com/platform/api/v1/widget/894f5aed-29f5-46c5-9f26-022bfccc5292/analytics"

Example Response:

{
"dates": [
{
"timestamp": 1698796800000,
"date": "11-01-2023",
"widget-load": 3,
"widget-view": 2
},
{
"timestamp": 1701388800000,
"date": "12-01-2023",
"widget-load": 13,
"widget-view": 5
}
]
}
Tip

The response will contain a dates array of analytics objects. The timestamp property is a timestamp in milliseconds.

If you have specified events in the query parameters, each object will contain a property for each event with the total number of events for that date, else, all events will be returned.