Google Analytics API error “Selected dimensions and metrics cannot be queried together.”

▼魔方 西西 提交于 2019-12-01 07:28:10

问题


I have to retrieve as many different metrics from my GA ecommerce as I can all at once. I'm using google api ruby client for that. And keep getting an error:

"message"=>"Selected dimensions and metrics cannot be queried together." 

for example, for this request:

result = client.execute(api_method: api_method.data.ga.get, parameters: {
    'ids'        => 'ga:95561781',
    'start-date' => Date.new(2006,1,1).to_s,
    'end-date'   => Date.today.to_s,
    'dimensions' => 'ga:source,ga:medium,ga:country,ga:transactionId,ga:affiliation,ga:productSku,ga:productName',
    'metrics'    => 'ga:sessions,ga:transactionRevenue,ga:transactions,ga:uniquePurchases,ga:totalValue,ga:transactionTax'
})

How do I know what request metrics and dimensions I can combine and what not? And how can I retrieve as many data as I can?


回答1:


Not all dimensions and metrics can be queried together.

Selected dimensions and metrics cannot be queried together

Means that your request contains dimensions or metrics that can not be mixed.

You may use the Dimensions and Metrics developer reference to see which metrics and dimensions can be used together in your query



来源:https://stackoverflow.com/questions/29152101/google-analytics-api-error-selected-dimensions-and-metrics-cannot-be-queried-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!