Skip to content

Remove User Context from page view call of browser SDK

What does this MR do and why?

Fixes https://gitlab.com/gitlab-org/gitlab/-/issues/426410

We have removed user context as it should be added after Adding pseudonymization enrichment

How to set up and validate locally

  1. Enable feature flag browsersdk_tracking
rails c
Feature.enable?(:browsersdk_tracking)

This feature will only be supported for Gitlab.com, so make sure you make Gitlab.com? method to true in lib/gitlab.rb and restart gdk.

  def self.com?
    true
  end
  1. Clone https://gitlab.com/gitlab-org/snowplow-micro-configuration
  2. Update iglu.json file with below patch
diff --git a/config/iglu.json b/config/iglu.json
index b262c9f..2a78ce8 100644
--- a/config/iglu.json
+++ b/config/iglu.json
@@ -7,9 +7,7 @@
       {
         "name": "Iglu Central",
         "priority": 0,
-        "vendorPrefixes": [
-          "com.snowplowanalytics"
-        ],
+        "vendorPrefixes": ["com.snowplowanalytics"],
         "connection": {
           "http": {
             "uri": "http://iglucentral.com"
@@ -19,7 +17,7 @@
       {
         "name": "Iglu Central - GCP Mirror",
         "priority": 1,
-        "vendorPrefixes": [ "com.snowplowanalytics" ],
+        "vendorPrefixes": ["com.snowplowanalytics"],
         "connection": {
           "http": {
             "uri": "http://mirror01.iglucentral.com"
@@ -27,14 +25,12 @@
         }
       },
       {
-        "name": "Iglu Gitlab",
+        "name": "Iglu Gitlab Product Analytics",
         "priority": 0,
-        "vendorPrefixes": [
-          "com.gitlab"
-        ],
+        "vendorPrefixes": ["com.gitlab"],
         "connection": {
           "http": {
-            "uri": "https://gitlab-org.gitlab.io/iglu"
+            "uri": "https://gitlab-org.gitlab.io/analytics-section/product-analytics/iglu"
           }
         }
       }
  1. Run snowplow-micro.sh, It enables snowplow-micro on 9090 port.
  2. Update env variables inside gdk director and run gdk restart
export GITLAB_ANALYTICS_URL=http://localhost:9090
export GITLAB_ANALYTICS_ID=123
  1. Open any page locally and it should be sending page view event to product analytics collector host.
  2. In Page View tracking API call, there will be cx which is base64 encoded. Decode it and verify that it does not include user context (iglu:com.gitlab/user_context/jsonschema/1-0-0).

Screenshot_2023-10-02_at_10.08.04_AM 5. Compare that to any page view event from gitlab.com it will have user context added.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ankit Panchal

Merge request reports