Search code examples
google-analyticsgoogle-apigoogle-analytics-apisegment

Google Analytics API - allowed dimension/metrics in segments


I have server-side app creating Audiences with specific segments. I know the names of dimensions/metrics can differ for UI and API. Therefore I am using Dimensions & Metrics Explorer for checking the appropriate name in API.

Explorer settings:

  • API names
  • Only show allowed in segments

The problem is, that there are some dimensions/metrics which explorer tag as "allowed in segment" but I am getting error from API "ga:xyz is not allowed in advanced segments."

It is doing for example:

  • ga:revenuePerUser
  • ga:sessionsPerUser
  • ga:transactionsPerUser
  • ...

Do anyone know why? Is it bug in API documentation?


Solution

  • Documentation error. In the MetaData API, it is marked as "allowedInSegments": "false",

    https://www.googleapis.com/analytics/v3/metadata/ga/columns?pp=1