“@google-analytics/data”: “^4.x.x” add metricAggregations array. Throw error “Cannot serialize object to proto3 JSON since its .$type is unknown.”
I’m using "@google-analytics/data": "^4.7.0"
to request ga report, in the request array, I add some payloads which can be mocked by GA4 query explorer, payloads are like dateRanges
, metrics
, dimensions
, metricAggregations
, dimensionFilter
…, and called the function batchRunReports
to get back the report, but the error 'Cannot serialize object to proto3 JSON since its .$type is unknown. Use Type.fromObject(obj) before calling toProto3JSON.'
occurs when the script run through the metricAggregations
array, I don’t know how come it happened and how to fix it.