Incerteza
Incerteza

Reputation: 34884

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

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?

Upvotes: 7

Views: 13360

Answers (1)

maggieto
maggieto

Reputation: 613

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

Upvotes: 14

Related Questions