openapi: 3.0.0
servers:
  - url: https://www.googleapis.com/analytics/v2.4
info:
  contact:
    name: Google
    url: https://google.com
  description: Views and manages your Google Analytics data.
  license:
    name: Creative Commons Attribution 3.0
    url: http://creativecommons.org/licenses/by/3.0/
  termsOfService: https://developers.google.com/terms/
  title: Google Analytics
  version: v2.4
  x-apiClientRegistration:
    url: https://console.developers.google.com
  x-apisguru-categories:
    - analytics
  x-logo:
    url: https://www.gstatic.com/images/icons/material/product/2x/analytics_64dp.png
  x-origin:
    - converter:
        url: https://github.com/lucybot/api-spec-converter
        version: 2.7.31
      format: google
      url: https://www.googleapis.com/discovery/v1/apis/analytics/v2.4/rest
      version: v1
  x-preferred: false
  x-providerName: googleapis.com
  x-serviceName: analytics
externalDocs:
  url: https://developers.google.com/analytics/
tags:
  - name: data
  - name: management
paths:
  /data:
    get:
      description: Returns Analytics report data for a view (profile).
      operationId: analytics.data.get
      parameters:
        - description: Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
          in: query
          name: ids
          required: true
          schema:
            type: string
        - description: Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-DD.
          in: query
          name: start-date
          required: true
          schema:
            type: string
        - description: End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD.
          in: query
          name: end-date
          required: true
          schema:
            type: string
        - description: A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric must be specified to retrieve a valid Analytics report.
          in: query
          name: metrics
          required: true
          schema:
            type: string
        - description: A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.
          in: query
          name: dimensions
          schema:
            type: string
        - description: A comma-separated list of dimension or metric filters to be applied to the report data.
          in: query
          name: filters
          schema:
            type: string
        - description: The maximum number of entries to include in this feed.
          in: query
          name: max-results
          schema:
            type: integer
        - description: An Analytics advanced segment to be applied to the report data.
          in: query
          name: segment
          schema:
            type: string
        - description: A comma-separated list of dimensions or metrics that determine the sort order for the report data.
          in: query
          name: sort
          schema:
            type: string
        - description: An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
          in: query
          name: start-index
          schema:
            minimum: 1
            type: integer
      responses:
        "200":
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/analytics
          Oauth2c:
            - https://www.googleapis.com/auth/analytics
        - Oauth2:
            - https://www.googleapis.com/auth/analytics.readonly
          Oauth2c:
            - https://www.googleapis.com/auth/analytics.readonly
      tags:
        - data
    parameters:
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/userIp"
  /management/accounts:
    get:
      description: Lists all accounts to which the user has access.
      operationId: analytics.management.accounts.list
      parameters:
        - description: The maximum number of accounts to include in this response.
          in: query
          name: max-results
          schema:
            type: integer
        - description: An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
          in: query
          name: start-index
          schema:
            minimum: 1
            type: integer
      responses:
        "200":
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/analytics
          Oauth2c:
            - https://www.googleapis.com/auth/analytics
        - Oauth2:
            - https://www.googleapis.com/auth/analytics.readonly
          Oauth2c:
            - https://www.googleapis.com/auth/analytics.readonly
      tags:
        - management
    parameters:
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/userIp"
  "/management/accounts/{accountId}/webproperties":
    get:
      description: Lists web properties to which the user has access.
      operationId: analytics.management.webproperties.list
      parameters:
        - description: Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
          in: path
          name: accountId
          required: true
          schema:
            type: string
        - description: The maximum number of web properties to include in this response.
          in: query
          name: max-results
          schema:
            type: integer
        - description: An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
          in: query
          name: start-index
          schema:
            minimum: 1
            type: integer
      responses:
        "200":
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/analytics
          Oauth2c:
            - https://www.googleapis.com/auth/analytics
        - Oauth2:
            - https://www.googleapis.com/auth/analytics.readonly
          Oauth2c:
            - https://www.googleapis.com/auth/analytics.readonly
      tags:
        - management
    parameters:
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/userIp"
  "/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles":
    get:
      description: Lists views (profiles) to which the user has access.
      operationId: analytics.management.profiles.list
      parameters:
        - description: Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.
          in: path
          name: accountId
          required: true
          schema:
            type: string
        - description: Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.
          in: path
          name: webPropertyId
          required: true
          schema:
            type: string
        - description: The maximum number of views (profiles) to include in this response.
          in: query
          name: max-results
          schema:
            type: integer
        - description: An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
          in: query
          name: start-index
          schema:
            minimum: 1
            type: integer
      responses:
        "200":
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/analytics
          Oauth2c:
            - https://www.googleapis.com/auth/analytics
        - Oauth2:
            - https://www.googleapis.com/auth/analytics.readonly
          Oauth2c:
            - https://www.googleapis.com/auth/analytics.readonly
      tags:
        - management
    parameters:
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/userIp"
  "/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals":
    get:
      description: Lists goals to which the user has access.
      operationId: analytics.management.goals.list
      parameters:
        - description: Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
          in: path
          name: accountId
          required: true
          schema:
            type: string
        - description: Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
          in: path
          name: webPropertyId
          required: true
          schema:
            type: string
        - description: View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which refers to all the views (profiles) that user has access to.
          in: path
          name: profileId
          required: true
          schema:
            type: string
        - description: The maximum number of goals to include in this response.
          in: query
          name: max-results
          schema:
            type: integer
        - description: An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
          in: query
          name: start-index
          schema:
            minimum: 1
            type: integer
      responses:
        "200":
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/analytics
          Oauth2c:
            - https://www.googleapis.com/auth/analytics
        - Oauth2:
            - https://www.googleapis.com/auth/analytics.readonly
          Oauth2c:
            - https://www.googleapis.com/auth/analytics.readonly
      tags:
        - management
    parameters:
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/userIp"
  /management/segments:
    get:
      description: Lists advanced segments to which the user has access.
      operationId: analytics.management.segments.list
      parameters:
        - description: The maximum number of advanced segments to include in this response.
          in: query
          name: max-results
          schema:
            type: integer
        - description: An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
          in: query
          name: start-index
          schema:
            minimum: 1
            type: integer
      responses:
        "200":
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/analytics
          Oauth2c:
            - https://www.googleapis.com/auth/analytics
        - Oauth2:
            - https://www.googleapis.com/auth/analytics.readonly
          Oauth2c:
            - https://www.googleapis.com/auth/analytics.readonly
      tags:
        - management
    parameters:
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/userIp"
components:
  parameters:
    alt:
      description: Data format for the response.
      in: query
      name: alt
      schema:
        default: atom
        enum:
          - atom
        type: string
    fields:
      description: Selector specifying which fields to include in a partial response.
      in: query
      name: fields
      schema:
        type: string
    key:
      description: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      in: query
      name: key
      schema:
        type: string
    oauth_token:
      description: OAuth 2.0 token for the current user.
      in: query
      name: oauth_token
      schema:
        type: string
    prettyPrint:
      description: Returns response with indentations and line breaks.
      in: query
      name: prettyPrint
      schema:
        default: false
        type: boolean
    quotaUser:
      description: An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      in: query
      name: quotaUser
      schema:
        type: string
    userIp:
      description: Deprecated. Please use quotaUser instead.
      in: query
      name: userIp
      schema:
        type: string
  securitySchemes:
    Oauth2:
      description: Oauth 2.0 implicit authentication
      flows:
        implicit:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          scopes:
            https://www.googleapis.com/auth/analytics: View and manage your Google Analytics data
            https://www.googleapis.com/auth/analytics.readonly: View your Google Analytics data
      type: oauth2
    Oauth2c:
      description: Oauth 2.0 accessCode authentication
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          scopes:
            https://www.googleapis.com/auth/analytics: View and manage your Google Analytics data
            https://www.googleapis.com/auth/analytics.readonly: View your Google Analytics data
          tokenUrl: https://accounts.google.com/o/oauth2/token
      type: oauth2
