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

  1. Follow the instructions to set up the Product Analytics DevKit on your machine.
  2. 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

  1. Enable the required feature flags.

  2. Run GDK in SaaS mode with an Ultimate license.

  3. Set the Ultimate plan on your test group.

  4. Enable Experiment & Beta features on your test group.

    1. Go to Settings > General.
    2. Expand Permissions and group features.
    3. Enable Experiment & Beta features and Product analytics.
    4. Select Save changes.
  5. 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

  1. On the left sidebar, at the top, select Search GitLab ({search}) to find the project set up in the previous section.
  2. 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 flagDefault enabledIntroduced by
product_analytics_admin_settingsfalsehttps://gitlab.com/gitlab-org/gitlab/-/merge_requests/167192
product_analytics_featuresfalsehttps://gitlab.com/gitlab-org/gitlab/-/merge_requests/167296
product_analytics_billingtruehttps://gitlab.com/gitlab-org/gitlab/-/merge_requests/141624
product_analytics_billing_overridefalsehttps://gitlab.com/gitlab-org/gitlab/-/merge_requests/148991
product_analytics_usage_quota_annual_datafalsehttps://gitlab.com/gitlab-org/gitlab/-/merge_requests/136932
generate_cube_queryfalsehttps://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:

  1. 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.

  2. Enable the additional_snowplow_tracking ops feature flag:

    echo "Feature.enable(:additional_snowplow_tracking)" | gdk rails c
  3. If a project hasn’t already been onboarded, follow the instructions to onboard a project with your Product Analytics self-managed provider (DevKit).

  4. On the left sidebar, at the top, select Search GitLab ({search}) to find the onboarded project.

  5. On the left sidebar, select Settings > Analytics.

  6. Expand the Data sources section.

  7. Copy the values of SDK host and SDK application ID.

  8. 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>"
  9. Restart GDK:

    gdk restart
  10. Navigate around your GDK.

  11. Go back to your GDK tracking project, which should now have data.

Last updated on