doc/development/internal_analytics/product_analytics.md
{{< details >}}
{{< /details >}}
{{< history >}}
cube_api_proxy. Disabled by default.cube_api_proxy changed to reference only the product analytics API in GitLab 15.6.cube_api_proxy removed and replaced with product_analytics_internal_preview in GitLab 15.10.product_analytics_internal_preview replaced with product_analytics_dashboards in GitLab 15.11.product_analytics_snowplow_support. Disabled by default.product_analytics_snowplow_support removed in GitLab 16.4.product_analytics_dashboards enabled by default in GitLab 16.11.product_analytics_dashboards removed in GitLab 17.1.product_analytics_admin_settings and product_analytics_features added in GitLab 17.5. Disabled by default.{{< /history >}}
[!flag] 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.
The product analytics feature empowers you to track user behavior and gain insights into how your applications are used and how users interact with your product. By using the data collected with product analytics in GitLab, you can better understand your users, identify friction points in funnels, make data-driven product decisions, and ultimately build better products that drive user engagement and business growth.
<i class="fa-youtube-play" aria-hidden="true"></i> For an overview of the product analytics setup and functionality, watch the Product Analytics walkthrough videos.
For more information about the vision and development of product analytics, see the group direction page. To leave feedback about product analytics bugs or functionality:
group::platform insights label.Product analytics uses the following tools:
The following diagram illustrates the product analytics flow:
%%{init: { "fontFamily": "GitLab Sans" }}%%
flowchart TB
accTitle: Product Analytics flow
accDescr: How data is collected, processed, and visualized in dashboards.
subgraph Event collection
A([SDK]) --Send user data--> B[Snowplow Collector]
B --Pass data--> C[Snowplow Enricher]
end
subgraph Data warehouse
C --Transform and enrich data--> D([ClickHouse])
end
subgraph Data visualization
F([Dashboards with panels/visualizations])
F --Request data--> G[Product Analytics API]
G --Run Cube queries with pre-aggregations--> H[Cube]
H --Get data--> D
D --Return results--> H
H --Transform data to be rendered--> G
G --Return data--> F
end
{{< history >}}
cube_api_proxy. Disabled by default.product_analytics_admin_settings in GitLab 15.7. Disabled by default.cube_api_proxy removed and replaced with product_analytics_internal_preview in GitLab 15.10.product_analytics_internal_preview replaced with product_analytics_dashboards in GitLab 15.11.product_analytics_admin_settings enabled by default in GitLab 16.11.product_analytics_admin_settings removed in GitLab 17.1.{{< /history >}}
To track events in your project's applications, you must enable and configure product analytics.
{{< history >}}
{{< /history >}}
Your GitLab instance connects to a product analytics provider. A product analytics provider is the collection of services required to receive, process, store and query your analytics data.
{{< tabs >}}
{{< tab title="GitLab-managed provider" >}}
On GitLab.com you can use a GitLab-managed provider offered only in the Google Cloud Platform zone us-central-1.
If GitLab manages your product analytics provider, then your analytics data is retained for one year. You can request to delete your data at any time by contacting support.
{{< /tab >}}
{{< tab title="Self-managed provider" >}}
A self-managed product analytics provider is a deployed instance of the product analytics Helm charts.
On GitLab.com, the self-managed provider details are defined in project-level settings.
On GitLab Self-Managed, you must define the self-managed analytics provider in instance-level settings. If you need different providers for different projects, you can define additional analytics providers in project-level settings.
{{< /tab >}}
{{< /tabs >}}
{{< details >}}
{{< /details >}}
Prerequisites:
[!note] These instance-level settings are required to enable product analytics on GitLab Self-Managed, and cascade to all projects by default.
To enable product analytics on your instance:
If you want to have a product analytics instance with a different configuration for your project, you can override the instance-level settings defined by the administrator on a per-project basis.
Prerequisites:
{{< history >}}
{{< /history >}}
Prerequisites:
Onboarding a GitLab project means preparing it to receive events that are used for product analytics.
To onboard a project:
Then continue with the setup depending on the provider type.
{{< tabs >}}
{{< tab title="GitLab-managed provider" >}}
Prerequisites:
Your instance is being created, and the project onboarded.
{{< /tab >}}
{{< tab title="Self-managed provider" >}}
Your instance is being created, and the project onboarded.
{{< /tab >}}
{{< /tabs >}}
You can instrument code to collect data by using tracking SDKs.
{{< history >}}
product_analytics_internal_preview. Disabled by default.{{< /history >}}
Product analytics dashboards are a subset of dashboards under Analytics dashboards.
Specifically, product analytics dashboards and visualizations use the cube_analytics data type.
The cube_analytics data type connects to the Cube instance defined when product analytics was enabled.
All filters and queries are sent to the Cube instance, and the returned data is processed by the
product analytics data source to be rendered by the appropriate visualizations.
Data table visualizations from cube_analytics have an additional configuration option for rendering links.
This option is an array of objects, each with text and href properties to specify the dimensions to be used in links.
If href contains multiple dimensions, values are joined into a single URL.
View an example.
When product analytics is enabled and onboarded, two built-in dashboards are available:
{{< history >}}
product_analytics_dashboards. Disabled by default.{{< /history >}}
When exporting data or viewing dashboards,
if there is no data for a given day, the missing data is autofilled with 0.
The autofill approach has both benefits and limitations.
day granularity must be used.
All other granularities are not supported.inDateRange filter are filled.
0. Issue 417231 proposes a solution to this limitation.Exporting the raw event data from the underlying storage engine can help you debug and create datasets for data analysis.
Because Cube acts as an abstraction layer between the raw data and the API, the exported raw data has some caveats:
utcTime and userAnonymousId.limit and offset parameters.Issue 391683 tracks efforts to implement a more scalable export solution.
You can query the raw data with the REST API, and convert the JSON output to any required format.
To export the raw data for a specific dimension, pass a list of dimensions to the dimensions key.
For example, the following query outputs the raw data for the attributes listed:
POST /api/v4/projects/PROJECT_ID/product_analytics/request/load?queryType=multi
{
"query":{
"dimensions": [
"TrackedEvents.docEncoding",
"TrackedEvents.docHost",
"TrackedEvents.docPath",
"TrackedEvents.docSearch",
"TrackedEvents.eventType",
"TrackedEvents.localTzOffset",
"TrackedEvents.pageTitle",
"TrackedEvents.src",
"TrackedEvents.utcTime",
"TrackedEvents.vpSize"
],
"order": {
"TrackedEvents.apiKey": "asc"
}
}
}
If the request is successful, the returned JSON includes an array of rows of results.
{{< history >}}
product_analytics_usage_quota. Disabled by default.product_analytics_usage_quota removed.{{< /history >}}
Product analytics usage quota is calculated from the number of events received from instrumented applications.
To view product analytics usage quota:
The tab displays the monthly totals for the group and a breakdown of usage per project. The current month displays events counted to date.
The usage quota excludes projects that are not onboarded with product analytics.
Check your instrumentation details, and make sure product analytics is enabled and set up correctly.
Check that you are connected to a product analytics provider.