Dưới đây là truy vấn mẫu cho product_performance_view
. Truy vấn này trả về hiệu suất của tài khoản trong 30 ngày qua, được phân đoạn theo marketing_method
và offer_id
. Bạn có thể thử ví dụ nhanh này để làm quen với Merchant Reports API.
Để truy xuất báo cáo này, bạn cần có vai trò Hiệu suất và thông tin chi tiết. Để biết thêm thông tin, hãy xem phần Yêu cầu.
Để gửi yêu cầu, hãy truyền câu lệnh Ngôn ngữ truy vấn Merchant Center sau đây vào phương thức accounts.reports.search
:
SELECT
marketing_method,
offer_id,
impressions,
clicks,
click_through_rate
FROM product_performance_view
WHERE date BETWEEN '2023-11-01' AND '2023-11-30'
URL yêu cầu HTTP
Yêu cầu này bao gồm một yêu cầu POST qua HTTP đến máy chủ API Báo cáo người bán tại URL sau:
https://merchantapi.googleapis.com/reports/v1beta/accounts/ACCOUNT_ID/reports:search
Mẫu yêu cầu HTTP hoàn chỉnh
Dưới đây là ví dụ đầy đủ cho thấy định nghĩa báo cáo được đưa vào trong yêu cầu POST qua HTTP:
POST https://merchantapi.googleapis.com/reports/v1beta/accounts/ACCOUNT_ID/reports:search HTTP/1.1 Parameters: { "query" : "SELECT marketing_method, offer_id, impressions, clicks, click_through_rate FROM product_performance_view WHERE date BETWEEN '2023-11-01' AND '2023-11-30'" }
Dưới đây là một phản hồi mẫu:
{
"results": [
{
"productPerformanceView": {
"marketingMethod": "ADS",
"offerId": "12345",
"clicks": "38",
"impressions": "1038",
"clickThroughRate": "0.3661"
}
},
{
"productPerformanceView": {
"marketingMethod": "ADS",
"offerId": "12346",
"clicks": "126",
"impressions": "1126",
"clickThroughRate": "0.1119"
}
},
{
"productPerformanceView": {
"marketingMethod": "ORGANIC",
"offerId": "12346",
"clicks": "26",
"impressions": "526",
"clickThroughRate": "0.0494"
}
},
{
"productPerformanceView": {
"marketingMethod": "ADS",
"offerId": "12347",
"clicks": "227",
"impressions": "1227",
"clickThroughRate": "0.1850"
}
},
{
"productPerformanceView": {
"marketingMethod": "ORGANIC",
"offerId": "12347",
"clicks": "12",
"impressions": "512",
"clickThroughRate": "0.0234"
}
}
]
}
Để biết thêm thông tin về các trường có thể dùng để truy vấn, hãy xem phần Các trường trong bảng productPerformanceView
.