Thống Kê
Được sử dụng để thu thập thông tin thống kê của Mini App trong một khoảng thời gian cụ thể. Các loại dữ liệu thống kê hiện có xem tại đây.
Parameters
Field | Type | Example | Required | Description |
---|---|---|---|---|
miniAppId | long | 3595174957789840753 | true | ID của Mini App tương ứng |
type | StatsType | ACCESS_TRAFFIC | true | Loại dữ liệu thống kê cần lấy |
startTime | long | 1692032400000 | true | Thời gian bắt đầu lấy dữ liệu |
endTime | long | 1692032400000 | true | Thời gian kết thúc lấy dữ liệu |
utmSource | string | all | Chỉ cần truyền với param type nhất định | |
utmCampaign | string | all | Chỉ cần truyền với param type nhất định | |
os | string | all | Chỉ cần truyền với param type nhất định |
Lưu ý
Khoảng thời gian lấy dữ liệu trong vòng 90 ngày.
Return Value
Attribute | Type | Description |
---|---|---|
err | number | Thành công / thất bại |
msg | string | Thành công / thất bại |
data | object | Dữ liệu thành công (nếu có) |
Sample Code
- Java
- Node.js
import com.vng.zalo.miniapp.openapi.sdk.models.StatsRequest;
import com.vng.zalo.miniapp.openapi.sdk.models.StatsResponse;
StatsRequest request = new StatsRequest();
request.setMiniAppId(1715668302514286127L);
request.setType(StatsType.ACCESS_TRAFFIC);
request.setStartTime(1701363600000L);
request.setEndTime(1702486800000L);
request.setUtmSource("zalo-search");
request.setUtmMedium("zalo-search");
request.setUtmCampaign("zalo-search");
request.setOs("Android");
StatsResponse response = client.getStats(request);
const statsRequest: StatsRequest = {
miniAppId: "<your appId>",
type: StatsType.ACCESS_TRAFFIC,
startTime: 1700240400000,
endTime: 1702832399999,
utmSource: "zalo-search",
};
const { error, message, data } = await client.getStats(statsRequest);
Error Code
Tham khảo tại đây