我正在将我的应用程序迁移到 V4,问题是您需要将 includeEmptyRows 设置为 TRUE,这就是我刚刚所做的。然而,空行根本没有填充。
function queryReports() {
gapi.client.request({
path: '/v4/reports:batchGet',
root: 'https://analyticsreporting.googleapis.com/',
method: 'POST',
body: {
reportRequests: [
{
**includeEmptyRows: 'true',**
//**this above for empty rows
viewId: VIEW_ID,
dateRanges: [
{
startDate: startDate0,
endDate: endDate0
}
],
//**below samplimg levels
samplingLevel: 'LARGE',
//request metrics here
metrics: [
{
expression: 'ga:sessions',
}
,
{
expression:'ga:goalCompletionsAll',
},
{
expression:'ga:transactionRevenue',
},
{
expression:'ga:transactions',
},
],
//request dimensions here
dimensions: [
{
name:'ga:channelGrouping',
},
{
name:'ga:yearMonth',
},
],
}
]
}
}).then(displayResults, console.error.bind(console)); …Run Code Online (Sandbox Code Playgroud)