Product Analytics
Product Analytics must be run locally in conjunction with the Product Analytics DevKit.
Product Analytics DevKit setup
Prerequisites
- You must have Docker (or equivalent) on your machine.
Set up the Product Analytics DevKit
- Follow the instructions to set up the Product Analytics DevKit on your machine.
- Continue following the instructions to connect the GDK to the Product Analytics DevKit.
GDK setup
Prerequisites
- Your GDK instance must have an active license for GitLab Ultimate.
- For billing functionality, your GDK must simulate a SaaS instance.
One-line setup
To automatically set up Product Analytics, in your gitlab
directory run the following command:
RAILS_ENV=development bundle exec rake gitlab:product_analytics:setup\['gitlab-org'\]
Note
You can replace gitlab-org
with the group name you want to enable Product Analytics on.
After running the command set up the DevKit if you haven’t already done so.
Once set up, you can follow the instructions below on how to onboard projects to product analytics.
Manual setup
Enable the required feature flags.
Run GDK in SaaS mode with an Ultimate license.
Set the Ultimate plan on your test group.
Enable Experiment & Beta features on your test group.
- Go to Settings > General.
- Expand Permissions and group features.
- Enable Experiment & Beta features and Product analytics.
- Select Save changes.
Set up the DevKit and connect it to your GDK.
Once set up, you can follow the instructions below on how to onboard projects to product analytics.
Onboarding projects to Product Analytics
Follow the instructions to onboard a project with your Product Analytics.
For day-to-day local development, you can use the self-managed provider option. To use the instance-level Product Analytics settings, make sure Use instance-level settings is selected.
For local development of the billing functionality, you should use the GitLab-managed provider option.
Once set up, you can follow the instructions below on how to view the product analytics dashboards.
View Product Analytics dashboards
- On the left sidebar, at the top, select Search GitLab ({search}) to find the project set up in the previous section.
- On the left sidebar, select Analyze > Analytics dashboards.
Feature flags
Product analytics features are behind feature flags and must be enabled to use them in GDK.
Note
The one-line setup command enables all product analytics related feature flags.
Feature flag | Default enabled | Introduced by |
---|---|---|
product_analytics_admin_settings | false | https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167192 |
product_analytics_features | false | https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167296 |
product_analytics_billing | true | https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141624 |
product_analytics_billing_override | false | https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148991 |
product_analytics_usage_quota_annual_data | false | https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136932 |
generate_cube_query | false | https://gitlab.com/gitlab-org/gitlab/-/merge_requests/140107 |
To enable a feature flag, run:
echo "Feature.enable(:FEATURE_FLAG_NAME)" | gdk rails c
To disable a feature flag, run:
echo "Feature.disable(:FEATURE_FLAG_NAME)" | gdk rails c
Connect GitLab tracking to Product Analytics
To simplify generating test data, you can connect your GDK to your Product Analytics DevKit, which:
- Causes all normal GitLab analytics events to be sent to your DevKit as you navigate around your local copy of GitLab.
- Automatically fills Product Analytics data while you go about your work.
To connect GDK to your Product Analytics DevKit:
Follow the instructions to set up Snowplow Micro on your machine. By default, Snowplow Micro uses the same port as the Snowplow instance running within the DevKit. Therefore, you must follow the port change step in the instructions.
Enable the
additional_snowplow_tracking
ops feature flag:echo "Feature.enable(:additional_snowplow_tracking)" | gdk rails c
If a project hasn’t already been onboarded, follow the instructions to onboard a project with your Product Analytics self-managed provider (DevKit).
On the left sidebar, at the top, select Search GitLab ({search}) to find the onboarded project.
On the left sidebar, select Settings > Analytics.
Expand the Data sources section.
Copy the values of SDK host and SDK application ID.
Using
env.runit
or your terminal runtime configuration (.bashrc
,.zshrc
etc), add the following (replacing the values):export GITLAB_ANALYTICS_URL="<SDK_HOST>" export GITLAB_ANALYTICS_ID="<SDK_APPLICATION_ID>"
Restart GDK:
gdk restart
Navigate around your GDK.
Go back to your GDK tracking project, which should now have data.