Analytics
Retrieve analytics chart data
Runs the chart query for the given chart_type and returns content.stats. Row shape varies by chart; business_name appears on top_customers rows only.
GET
/
analytics
/
charts
Retrieve analytics chart data
curl --request GET \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts \
--header 'Authorization: Bearer <token>'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"user_params": {},
"query_params": {
"store_id": "<string>",
"date_from": "<string>",
"date_to": "<string>",
"day_hour": "<string>",
"timezone": "<string>",
"product_id": "<string>",
"variant_id": [
"<string>"
]
},
"queries": [
"<string>"
],
"stats": [
{
"date": "2023-11-07T05:31:56Z",
"metrics": {
"total_order": 123,
"completed_order": 123,
"live_order": 123,
"cancelled_order": 123,
"unique_users": 123,
"total_views": 123,
"total_events": 123,
"net_revenue": "<string>",
"gross_revenue": "<string>",
"total_revenue": "<string>",
"total_spending": "<string>",
"completed_order_revenue": "<string>",
"live_order_revenue": "<string>",
"cancelled_order_revenue": "<string>"
},
"source": "<string>",
"user_id": "<string>",
"product_id": "<string>",
"sku_name": "<string>",
"order_source": "<string>",
"order_utm_source": "<string>",
"order_utm_campaign": "<string>",
"order_utm_medium": "<string>",
"order_utm_term": "<string>",
"name": "<string>",
"business_name": "<string>",
"variant_id": "<string>",
"image_url": "<string>",
"state": "<string>",
"city": "<string>",
"courier": "<string>",
"unique_users": 123,
"order_count": 123,
"user_count": 123,
"total_orders": 123,
"unique_customers": 123,
"repeat_customers": 123,
"orders_shipped": 123,
"shipments_delivered_early": 123,
"shipments_delivered_on_time": 123,
"shipments_delivered_late": 123,
"total_carts_created": 123,
"total_carts_created_customer_count": 123,
"carts_with_address_added": 123,
"carts_with_address_added_customer_count": 123,
"total_orders_created": 123,
"total_orders_created_customer_count": 123,
"total_orders_completed": 123,
"total_orders_completed_customer_count": 123,
"repeat_customer_rate": 123,
"avg_days_between_orders": 123,
"avg_time_to_ship": 123,
"avg_transit_time": 123,
"avg_delivery_time": 123,
"total_order_value": "<string>",
"avg_order_value": "<string>"
}
],
"lifetime_stats": [
{
"total_order": 123,
"completed_order": 123,
"live_order": 123,
"cancelled_order": 123,
"unique_users": 123,
"total_views": 123,
"total_events": 123,
"net_revenue": "<string>",
"gross_revenue": "<string>",
"total_revenue": "<string>",
"total_spending": "<string>",
"completed_order_revenue": "<string>",
"live_order_revenue": "<string>",
"cancelled_order_revenue": "<string>"
}
]
}
}{
"message": "<string>",
"success": true,
"code": "<string>",
"errors": {},
"content": {},
"details": "<string>"
}{
"message": "<string>",
"success": true,
"code": "<string>",
"details": "<string>"
}{
"message": "<string>",
"success": true,
"code": "<string>",
"details": "<string>",
"error_id": "<string>"
}Authorizations
Query Parameters
For metrics: order_stats, visitor_stats, page_view_stats, event_stats. For stats: unique_visitors, top_customers, associated_campaigns, ce_item_stats, state_wise_shipments_delivery, state_wise_shipping_performance, average_shipping_time_per_courier, shipping_performance_by_courier, average_time_between_subsequent_purchases, city_wise_shipping_performance, overall_shipping_performance, checkout_funnel, product_checkout_funnel. For records, no chart data is returned. product_checkout_funnel requires product_id and variant_id.
Was this page helpful?
⌘I
Retrieve analytics chart data
curl --request GET \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts \
--header 'Authorization: Bearer <token>'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/analytics/charts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"user_params": {},
"query_params": {
"store_id": "<string>",
"date_from": "<string>",
"date_to": "<string>",
"day_hour": "<string>",
"timezone": "<string>",
"product_id": "<string>",
"variant_id": [
"<string>"
]
},
"queries": [
"<string>"
],
"stats": [
{
"date": "2023-11-07T05:31:56Z",
"metrics": {
"total_order": 123,
"completed_order": 123,
"live_order": 123,
"cancelled_order": 123,
"unique_users": 123,
"total_views": 123,
"total_events": 123,
"net_revenue": "<string>",
"gross_revenue": "<string>",
"total_revenue": "<string>",
"total_spending": "<string>",
"completed_order_revenue": "<string>",
"live_order_revenue": "<string>",
"cancelled_order_revenue": "<string>"
},
"source": "<string>",
"user_id": "<string>",
"product_id": "<string>",
"sku_name": "<string>",
"order_source": "<string>",
"order_utm_source": "<string>",
"order_utm_campaign": "<string>",
"order_utm_medium": "<string>",
"order_utm_term": "<string>",
"name": "<string>",
"business_name": "<string>",
"variant_id": "<string>",
"image_url": "<string>",
"state": "<string>",
"city": "<string>",
"courier": "<string>",
"unique_users": 123,
"order_count": 123,
"user_count": 123,
"total_orders": 123,
"unique_customers": 123,
"repeat_customers": 123,
"orders_shipped": 123,
"shipments_delivered_early": 123,
"shipments_delivered_on_time": 123,
"shipments_delivered_late": 123,
"total_carts_created": 123,
"total_carts_created_customer_count": 123,
"carts_with_address_added": 123,
"carts_with_address_added_customer_count": 123,
"total_orders_created": 123,
"total_orders_created_customer_count": 123,
"total_orders_completed": 123,
"total_orders_completed_customer_count": 123,
"repeat_customer_rate": 123,
"avg_days_between_orders": 123,
"avg_time_to_ship": 123,
"avg_transit_time": 123,
"avg_delivery_time": 123,
"total_order_value": "<string>",
"avg_order_value": "<string>"
}
],
"lifetime_stats": [
{
"total_order": 123,
"completed_order": 123,
"live_order": 123,
"cancelled_order": 123,
"unique_users": 123,
"total_views": 123,
"total_events": 123,
"net_revenue": "<string>",
"gross_revenue": "<string>",
"total_revenue": "<string>",
"total_spending": "<string>",
"completed_order_revenue": "<string>",
"live_order_revenue": "<string>",
"cancelled_order_revenue": "<string>"
}
]
}
}{
"message": "<string>",
"success": true,
"code": "<string>",
"errors": {},
"content": {},
"details": "<string>"
}{
"message": "<string>",
"success": true,
"code": "<string>",
"details": "<string>"
}{
"message": "<string>",
"success": true,
"code": "<string>",
"details": "<string>",
"error_id": "<string>"
}