My favorites | English | Sign in

Faster apps faster - GWT 2.0 with Speed Tracer New!

Google Analytics (Labs)

Valid Query Combinations

This document describes how you can construct Data Export API queries using a combination of dimensions and metrics. Not all combinations are valid, and when you request an invalid combination of dimensions and metrics, you will receive an error message indicating that you have made an invalid request. There are basically three ways you can determine if your request contains a valid combination:

  1. 1. Explore the Custom Reports UI
  2. 2. Explore 2-Pair Combinations
  3. 3. Use the Query Validation Chart

1. Explore the Custom Report UI

The Analytics Data Export API provides a similar set of metrics and dimensions as the Custom Reporting interface of Google Analytics. All the combination restrictions that apply when creating a custom report also apply to constructing a dimension/metric query in the API. The easiest way for you to familiarize yourself with these combinations is to use the Custom Reporting section of Google Analytics and select the dimension(s) or metric(s) you most want to use for your query. Immediately after you select your dimension or metric in the interface, you will notice that some dimensions/metrics will be unavailable for you to add to the custom report.

All dimensions and metrics map logically over to the Data Export API dimensions and metrics, even though they may not have precisely the same name.

Back to Top

2. Explore 2-pair Combinations

If you are interested in exploring which combinations are valid with a particular dimension or metric, refer to the tables below:

Important: This table illustrates only 2-field combinations, either for a metric/metric or a dimension/metric. Dimension-only queries are not valid. If you need to check the validity of a query that has more than 2 fields (e.g. dimension,dimenson,metric) use the query validation chart below, because multiple field combinations are more restrictive than 2-field combinations.

Dimension Category Valid
Metrics
D1. Visitor, excluding Time dimensions All metrics, except:
M2. Campaign

ga:visitors
D2. Campaign All metrics, except ga:visitors
D3. Content, excluding
ga:pagePath, ga:pageTitle
All metrics, except:
M2. Campaign
M7. Events

ga:visitors
ga:visits
ga:timeOnSite
D3. Content, only for
ga:pagePath, ga:pageTitle
All metrics, except:
M2. Campaign
ga:visitors
D4. Ecommerce All metrics, except:
M2. Campaign
ga:visitors
D5. Internal Search All metrics, except:
M2. Campaign
ga:visitors
Hour All metrics, except:
M2. Campaign
ga:visitors
Time dimensions, excluding ga:hour All metrics
D6. Navigation M6. Goals
ga:pageviews
ga:transactionRevenue
ga:transactions
D7. Events

M1. Visitor, except ga:visitors
M4. Ecommerce
M7. Events

Metric Category Valid Combinations
M1. Visitor, only for ga:pageviews All dimensions
All metrics
M1. Visitor, only for ga:visitors Time dimensions, except ga:hour
M1. Visitor metrics
M1. Visitor, only for:
ga:visits
ga:timeOnSite
All dimensions, except D6. Navigation, ga:exitPagePath, ga:landingPagePath, ga:secondPagepath
All metrics

M1. Visitor, excluding:
ga:visitors
ga:visits
ga:timeOnSite
ga:pageviews

All dimensions, except D6. Navigation
All metrics
M2. Campaign
 

D2. Campaign dimensions
Time dimensions, except ga:hour
All metrics, except M7. Events, ga:visitors
M3. Content (ga:uniquePageviews) All dimensions, except D6. Navigation, D7. Events
All metrics, except ga:visitors

M4. Ecommerce, only for:
ga:transactionRevenue
ga:transactions

All dimensions
All metrics, except ga:visitors

M4. Ecommerce, excluding:
ga:transactionRevenue
ga:transactions

All dimensions, except D6. Navigation
All metrics, except ga:visitors
M5. Internal Search All dimensions, except D6. Navigation, D7. Events
All metrics, except ga:visitors
M6. Goals
All dimensions, except D7. Events
All metrics, except ga:visitors
M7. Events
All dimensions, except D6. Navigation, ga:exitPagePath, ga:landingPagePath, ga:secondPagePath
All metrics, except M2 Campaign, ga:visitors

Back to Top

3. Use the Query Validation Chart

If your query contains more than 2 fields, use the chart below to determine allowable combinations for a group of dimensions and metrics. Keep in mind the following:

  • The allowable combinations progress from most restrictive to least.
  • Use the column on the left to determine the general type of query that you want.
If query contains... Allowable combinations for multiple fields are:
ga:visitor
Dimensions
Time dimensions, except ga:hour

Metrics
M1. Visitor
Any D6. Navigation
Dimensions
Any D6. Navigation

Metrics
M6. Goals
ga:pageviews
ga:transactionRevenue
ga:transactions
Any M2. Campaign
and/or
ga:adContent, ga:adSlot, ga:adSlotPosition
Dimensions
D2.Campaign
Time dimensions, except ga:hour

Metrics
Any metric except:
M7. Events
ga:visitor
Only D3. Content (any from the group)
Dimensions
D1.Visitor
D3.Content

Metrics
Any metric except:
M2.Campaign
M7. Events
ga:visits
ga:visitors
ga:timeOnSite
Any D3. Content
and
D2. Campaign, except:
ga:adContent
ga:adSlot
ga:adSlotPosition
Dimensions
Any dimension, except:
D4. Ecommerce
D6. Navigation
D7. Events
ga:adContent
ga:adSlot
ga:adSlotPosition

Metrics

M1.Visitor except  ga:visitorsga:visits, ga:timeOnSite
M3.Content
M5.Internal Search

Any D7. Event
and/or
ga:adContent, ga:adSlot, ga:adSlotPosition
Dimensions
D1. Visitor
D2. Campaign
D7. Events
ga:pagePath
ga:pageTitle

Metrics
M1.Visitor except ga:visitors
D4. Ecommerce
D7. Event
Anything other than listed above.
Dimensions
Any dimension, except:
D3. Content
D6. Navigation
D7. Events
ga:adContent
ga:adSlot
ga:adSlotPosition

Metrics
Any metric, except:
D2. Campaign
ga:visitors

 

Back to Top