Get Data Analysis

🔒

Requires read_data access scope.More access scope

The Get Data Analysis API retrieves analytical data for the specified time range and dimensions.

This enables users to:

  1. Analyze their shop's performance.
  2. Evaluate marketing efforts.
  3. Gain insights into user behavior.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Query Parameters

FieldTypeRequiredDescriptionExample
begin_timeint32YesThe starting timestamp (in seconds) for retrieving analysis data. Must be a valid Unix timestamp and less than end_time. Logic 1666512000
end_timeint32YesThe ending timestamp (in seconds) for retrieving analysis data. Must be a valid Unix timestamp and greater than begin_time.1682323199
indicatorarray<string>YesIndicators define the metrics you can query and are categorized into Custom Indicators and UTM Indicators.
Custom indicators are valid for custom dimensions:
pv,uv,add_cart_uv, add_cart_qty,add_payment_info_uv,begin_checkout_pv,
begin_checkout_uv,orders, sales,conversion_rate
UTM indicators are valid for UTM dimensions
pv,uv,add_cart_uv,begin_checkout_pv,
begin_checkout_uv,orders, sales
["pv", "sales"]
tzfloatNoTime zone adjustment for analysis, in hours.
Notice: Values outside the range -12 to 14 might lead to unexpected results in time-based calculations.
8
pageint32NoPage number for pagination .
Defaults to 1. Value must be greater than 0.
1
limitint32NoMaximum number of records per page. Defaults to 20 and cannot exceed 200.50
sort_bystringNoField for sorting the data, chosen from the indicator fields.sales
sort_directionstringNoSorting direction: asc (ascending) or desc (descending).desc
dt_bystringNoTime granularity for aggregation: dt_by_hour, dt_by_day.dt_by_day
dimensionarray<string>NoDimensions for the query:

- Valid custom dimensions include country_code.
- Valid UTM dimensions include utm_source, utm_medium, utm_term, utm_campaign, utm_content.
Notice: Mixing custom dimensions (e.g., country_code) with UTM-based dimensions will cause validation failure.
["utm_source", "utm_campaign"]
filtersarray<string>NoFilters for analysis, such as UTM source or country code.["utm_source=google", "country_code=CN"]

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Success Response

FieldTypeDescriptionExample
countintTotal number of records in the query.2
dataarrayArray of analytical data records.See data structure below
data.date_timestringTimestamp of the record (ISO 8601)."2023-05-16T16:00:00Z"
data.country_abbrstringCountry abbreviation or region name."shenzhen"
data.country_codestringISO country code."CN"
data.utm_sourcestringUTM source used for campaign tracking."-"
data.pvintPage views.0
data.uvintUnique visitors.0
data.add_cart_uvintNumber of unique visitors who added items to the cart.0
data.add_cart_qtyintTotal quantity of items added to the cart.0
data.begin_checkout_pvintPage views for the checkout page.0
data.begin_checkout_uvintUnique visitors who began the checkout process.0
data.ordersintNumber of orders placed.1
data.salesfloatTotal sales amount.10.6
data.conversion_ratefloatConversion rate calculated as orders / uv.0.5

Error Response

Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.

FieldTypeExampleDescription
errorString "page not found"Indicates an error encountered during the process

Error Detail

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure, such as missing required fields or exceeding limits.Bad Request
UnauthorizedMissing or invalid authentication credentials.Unauthorized
404Not foundScript's ID is empty or not provided"record not found"
422Unprocessable Entitypage is less than or equal to 0.page can't less or equals 0
limit is less than or equal to 0, or exceeds the maximum value (200).limit can't less or equals 0, limit max 200
dt_by value is invalid (not in supported values).dt_by not support
dimension contains unsupported fields, or mixes custom and UTM dimensions.not support dimension or not support use custom together with utm
indicator contains unsupported values for the selected dimension type.indicator not support when request is custom dimension, indicator not support when request is utm dimension
sort_by is not in the list of specified indicator values.sort_by need choose in the indicator
sort_direction value is invalid (not asc or desc).sort_direction not support
filters contain invalid key-value pairs (e.g., missing = or empty key/value).filter country_code illegal

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!