From 60a081ad26ee7a41d2fca137ddaf88d97a7d7640 Mon Sep 17 00:00:00 2001
From: Ankit Panchal <apanchal@gitlab.com>
Date: Fri, 4 Oct 2024 06:56:07 +0000
Subject: [PATCH] Remove snowplow property/label from some events Frontend

---
 .../components/filtered_search_and_sort.vue   | 21 +------------------
 .../sidebar/components/forks_filter/index.vue |  4 +---
 ...t_include_forks_on_search_results_page.yml |  3 ---
 .../use_filter_bar_projects_explore.yml       |  3 ---
 .../components/vulnerability_training.vue     |  4 +---
 .../vulnerability_training_spec.js            |  4 +---
 .../filtered_search_and_sort_spec.js          |  8 +------
 .../sidebar/components/forked_filter_spec.js  |  2 +-
 8 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/app/assets/javascripts/projects/filtered_search_and_sort/components/filtered_search_and_sort.vue b/app/assets/javascripts/projects/filtered_search_and_sort/components/filtered_search_and_sort.vue
index 6ee6be85d40c0..1d18d7d146bff 100644
--- a/app/assets/javascripts/projects/filtered_search_and_sort/components/filtered_search_and_sort.vue
+++ b/app/assets/javascripts/projects/filtered_search_and_sort/components/filtered_search_and_sort.vue
@@ -152,26 +152,7 @@ export default {
         queryObject.personal = this.queryAsObject.personal;
       }
 
-      const trackingProperty = Object.entries(filtersQuery).reduce(
-        (accumulator, [tokenType, optionValue]) => {
-          if (tokenType === FILTERED_SEARCH_TERM_KEY) {
-            return {
-              ...accumulator,
-              search: optionValue,
-            };
-          }
-
-          const token = this.filteredSearchTokens.find(({ type }) => type === tokenType);
-          const option = token.options.find(({ value }) => value === optionValue[0]);
-
-          return { ...accumulator, [token.title.toLowerCase()]: option.title };
-        },
-        {},
-      );
-
-      this.trackEvent(this.filterEventName, {
-        label: JSON.stringify(trackingProperty),
-      });
+      this.trackEvent(this.filterEventName);
 
       this.visitUrlWithQueryObject(queryObject);
     },
diff --git a/app/assets/javascripts/search/sidebar/components/forks_filter/index.vue b/app/assets/javascripts/search/sidebar/components/forks_filter/index.vue
index 8e79814701dcc..158488e45fc1a 100644
--- a/app/assets/javascripts/search/sidebar/components/forks_filter/index.vue
+++ b/app/assets/javascripts/search/sidebar/components/forks_filter/index.vue
@@ -41,9 +41,7 @@ export default {
   methods: {
     ...mapActions(['setQuery']),
     trackChange() {
-      this.trackEvent(EVENT_CLICK_ZOEKT_INCLUDE_FORKS_ON_SEARCH_RESULTS_PAGE, {
-        property: this.urlQuery.search,
-      });
+      this.trackEvent(EVENT_CLICK_ZOEKT_INCLUDE_FORKS_ON_SEARCH_RESULTS_PAGE);
     },
   },
 };
diff --git a/config/events/click_zoekt_include_forks_on_search_results_page.yml b/config/events/click_zoekt_include_forks_on_search_results_page.yml
index ec3ee42b1bc7a..87cf7a0f73c2c 100644
--- a/config/events/click_zoekt_include_forks_on_search_results_page.yml
+++ b/config/events/click_zoekt_include_forks_on_search_results_page.yml
@@ -6,9 +6,6 @@ identifiers:
 - project
 - namespace
 - user
-additional_properties:
-  property:
-    description: search term
 product_group: global_search
 milestone: '17.1'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154099
diff --git a/config/events/use_filter_bar_projects_explore.yml b/config/events/use_filter_bar_projects_explore.yml
index d85d74c61dd14..5872ab9fab4ed 100644
--- a/config/events/use_filter_bar_projects_explore.yml
+++ b/config/events/use_filter_bar_projects_explore.yml
@@ -4,9 +4,6 @@ internal_events: true
 action: use_filter_bar_projects_explore
 identifiers:
 - user
-additional_properties:
-  label:
-    description: JSON object of filter parameters
 product_group: tenant_scale
 milestone: '17.3'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158282
diff --git a/ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue b/ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
index c7f1385221b67..b6ef65116e037 100644
--- a/ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
+++ b/ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
@@ -143,9 +143,7 @@ export default {
   created() {
     const unwatchHasSecurityTrainingUrls = this.$watch('hasSecurityTrainingUrls', (hasUrls) => {
       if (hasUrls) {
-        this.track(TRACK_TRAINING_LOADED_ACTION, {
-          property: this.projectFullPath,
-        });
+        this.track(TRACK_TRAINING_LOADED_ACTION);
         // we only want to track this once, so we immediately unsubscribe after the first track
         unwatchHasSecurityTrainingUrls();
       }
diff --git a/ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js b/ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
index 9ffcbc9a71e67..e99cddeb34a02 100644
--- a/ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
+++ b/ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
@@ -433,9 +433,7 @@ describe('VulnerabilityTraining component', () => {
       await waitForQueryToBeLoaded();
 
       // after the first loading of the urls, the tracking should be called
-      expect(trackingSpy).toHaveBeenCalledWith(undefined, TRACK_TRAINING_LOADED_ACTION, {
-        property: projectFullPath,
-      });
+      expect(trackingSpy).toHaveBeenCalledWith(undefined, TRACK_TRAINING_LOADED_ACTION, {});
 
       // fake a poll-cycle
       jest.advanceTimersByTime(TRAINING_URL_POLLING_INTERVAL);
diff --git a/spec/frontend/projects/filtered_search_and_sort/components/filtered_search_and_sort_spec.js b/spec/frontend/projects/filtered_search_and_sort/components/filtered_search_and_sort_spec.js
index 78944e096db90..305fb77552a03 100644
--- a/spec/frontend/projects/filtered_search_and_sort/components/filtered_search_and_sort_spec.js
+++ b/spec/frontend/projects/filtered_search_and_sort/components/filtered_search_and_sort_spec.js
@@ -124,13 +124,7 @@ describe('ProjectsExploreFilteredSearchAndSort', () => {
     it('tracks event', () => {
       const { trackEventSpy } = bindInternalEventDocument(wrapper.element);
 
-      expect(trackEventSpy).toHaveBeenCalledWith(
-        defaultProvide.filterEventName,
-        {
-          label: JSON.stringify({ search: searchTerm, language: 'CSS' }),
-        },
-        undefined,
-      );
+      expect(trackEventSpy).toHaveBeenCalledWith(defaultProvide.filterEventName, {}, undefined);
     });
   });
 
diff --git a/spec/frontend/search/sidebar/components/forked_filter_spec.js b/spec/frontend/search/sidebar/components/forked_filter_spec.js
index 43b697ae016f8..ee981ead5306b 100644
--- a/spec/frontend/search/sidebar/components/forked_filter_spec.js
+++ b/spec/frontend/search/sidebar/components/forked_filter_spec.js
@@ -126,7 +126,7 @@ describe('ForksFilter', () => {
 
       expect(trackEventSpy).toHaveBeenCalledWith(
         EVENT_CLICK_ZOEKT_INCLUDE_FORKS_ON_SEARCH_RESULTS_PAGE,
-        { property: 'test' },
+        {},
         undefined,
       );
     });
-- 
GitLab