Product analytics API

  • Tier: Ultimate
  • Offering: GitLab.com, GitLab Self-Managed
  • Status: Beta

The availability of this feature is controlled by a feature flag. For more information, see the history. This feature is not ready for production use.

Use this API to track user behavior and application usage.

Make sure to define the cube_api_base_url and cube_api_key application settings first using the API.

Create a Cube query request

Creates a query request to the Cube API and generates an access token.

POST /projects/:id/product_analytics/request/load
POST /projects/:id/product_analytics/request/dry-run
AttributeTypeRequiredDescription
idintegeryesThe ID of a project that the current user has read access to.
include_tokenbooleannoWhether to include the access token in the response. (Only required for funnel generation.)

Request body

The body of the load request must be a valid Cube query.

When measuring TrackedEvents, you must use TrackedEvents.* for dimensions and timeDimensions. The same rule applies when measuring Sessions.

Tracked events example

{
  "query": {
    "measures": [
      "TrackedEvents.count"
    ],
    "timeDimensions": [
      {
        "dimension": "TrackedEvents.utcTime",
        "dateRange": "This week"
      }
    ],
    "order": [
      [
        "TrackedEvents.count",
        "desc"
      ],
      [
        "TrackedEvents.docPath",
        "desc"
      ],
      [
        "TrackedEvents.utcTime",
        "asc"
      ]
    ],
    "dimensions": [
      "TrackedEvents.docPath"
    ],
    "limit": 23
  },
  "queryType": "multi"
}

Sessions example

{
  "query": {
    "measures": [
      "Sessions.count"
    ],
    "timeDimensions": [
      {
        "dimension": "Sessions.startAt",
        "granularity": "day"
      }
    ],
    "order": {
      "Sessions.startAt": "asc"
    },
    "limit": 100
  },
  "queryType": "multi"
}

Retrieve Cube metadata

Retrieves Cube metadata for analytics data.

GET /projects/:id/product_analytics/request/meta
AttributeTypeRequiredDescription
idintegeryesThe ID of a project that the current user has read access to.