From 5f9d798a16e60d11a97a01e62d0ec7427f5cf060 Mon Sep 17 00:00:00 2001
From: Paul W <19602001-paintedbicycle-gitlab@users.noreply.gitlab.com>
Date: Thu, 4 Jul 2024 17:03:14 +0000
Subject: [PATCH] Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: Jonas Larsen <jlarsen@gitlab.com>
---
 .../view_admin_geo_settings_pageload.yml      | 15 +++++++++++++
 ...ew_admin_geo_settings_pageload_monthly.yml | 21 +++++++++++++++++++
 ...ew_admin_geo_settings_pageload_monthly.yml | 20 ++++++++++++++++++
 ...iew_admin_geo_settings_pageload_weekly.yml | 21 +++++++++++++++++++
 ...iew_admin_geo_settings_pageload_weekly.yml | 20 ++++++++++++++++++
 .../geo_settings/components/app.vue           |  6 ++++++
 .../javascripts/geo_settings/constants.js     |  2 ++
 7 files changed, 105 insertions(+)
 create mode 100644 config/events/view_admin_geo_settings_pageload.yml
 create mode 100644 config/metrics/counts_28d/count_distinct_user_id_from_view_admin_geo_settings_pageload_monthly.yml
 create mode 100644 config/metrics/counts_28d/count_total_view_admin_geo_settings_pageload_monthly.yml
 create mode 100644 config/metrics/counts_7d/count_distinct_user_id_from_view_admin_geo_settings_pageload_weekly.yml
 create mode 100644 config/metrics/counts_7d/count_total_view_admin_geo_settings_pageload_weekly.yml

diff --git a/config/events/view_admin_geo_settings_pageload.yml b/config/events/view_admin_geo_settings_pageload.yml
new file mode 100644
index 0000000000000..f0c3fc5f43ad5
--- /dev/null
+++ b/config/events/view_admin_geo_settings_pageload.yml
@@ -0,0 +1,15 @@
+---
+description: Tracks pageviews for the admin geo settings page
+internal_events: true
+action: view_admin_geo_settings_pageload
+identifiers:
+- user
+product_group: personal_productivity
+milestone: '17.2'
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157498
+distributions:
+- ce
+- ee
+tiers:
+- premium
+- ultimate
diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_view_admin_geo_settings_pageload_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_view_admin_geo_settings_pageload_monthly.yml
new file mode 100644
index 0000000000000..c3ca21fb780cb
--- /dev/null
+++ b/config/metrics/counts_28d/count_distinct_user_id_from_view_admin_geo_settings_pageload_monthly.yml
@@ -0,0 +1,21 @@
+---
+key_path: redis_hll_counters.count_distinct_user_id_from_view_admin_geo_settings_pageload_monthly
+description: Monthly count of unique users who visited the admin geo settings page
+product_group: personal_productivity
+performance_indicator_type: []
+value_type: number
+status: active
+milestone: '17.2'
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157498
+time_frame: 28d
+data_source: internal_events
+data_category: optional
+distribution:
+- ce
+- ee
+tier:
+- premium
+- ultimate
+events:
+- name: view_admin_geo_settings_pageload
+  unique: user.id
diff --git a/config/metrics/counts_28d/count_total_view_admin_geo_settings_pageload_monthly.yml b/config/metrics/counts_28d/count_total_view_admin_geo_settings_pageload_monthly.yml
new file mode 100644
index 0000000000000..61dcdf5d86df8
--- /dev/null
+++ b/config/metrics/counts_28d/count_total_view_admin_geo_settings_pageload_monthly.yml
@@ -0,0 +1,20 @@
+---
+key_path: counts.count_total_view_admin_geo_settings_pageload_monthly
+description: Monthly count of total users who visited the admin geo settings page
+product_group: personal_productivity
+performance_indicator_type: []
+value_type: number
+status: active
+milestone: '17.2'
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157498
+time_frame: 28d
+data_source: internal_events
+data_category: optional
+distribution:
+- ce
+- ee
+tier:
+- premium
+- ultimate
+events:
+- name: view_admin_geo_settings_pageload
diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_view_admin_geo_settings_pageload_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_view_admin_geo_settings_pageload_weekly.yml
new file mode 100644
index 0000000000000..03912cb5cdc86
--- /dev/null
+++ b/config/metrics/counts_7d/count_distinct_user_id_from_view_admin_geo_settings_pageload_weekly.yml
@@ -0,0 +1,21 @@
+---
+key_path: redis_hll_counters.count_distinct_user_id_from_view_admin_geo_settings_pageload_weekly
+description: Weekly count of unique users who visited the admin geo settings page
+product_group: personal_productivity
+performance_indicator_type: []
+value_type: number
+status: active
+milestone: '17.2'
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157498
+time_frame: 7d
+data_source: internal_events
+data_category: optional
+distribution:
+- ce
+- ee
+tier:
+- premium
+- ultimate
+events:
+- name: view_admin_geo_settings_pageload
+  unique: user.id
diff --git a/config/metrics/counts_7d/count_total_view_admin_geo_settings_pageload_weekly.yml b/config/metrics/counts_7d/count_total_view_admin_geo_settings_pageload_weekly.yml
new file mode 100644
index 0000000000000..c35627a2dbb8d
--- /dev/null
+++ b/config/metrics/counts_7d/count_total_view_admin_geo_settings_pageload_weekly.yml
@@ -0,0 +1,20 @@
+---
+key_path: counts.count_total_view_admin_geo_settings_pageload_weekly
+description: Weekly count of total users who visited the admin geo settings page
+product_group: personal_productivity
+performance_indicator_type: []
+value_type: number
+status: active
+milestone: '17.2'
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157498
+time_frame: 7d
+data_source: internal_events
+data_category: optional
+distribution:
+- ce
+- ee
+tier:
+- premium
+- ultimate
+events:
+- name: view_admin_geo_settings_pageload
diff --git a/ee/app/assets/javascripts/geo_settings/components/app.vue b/ee/app/assets/javascripts/geo_settings/components/app.vue
index 20d6f0099a3e6..38c4112caa35c 100644
--- a/ee/app/assets/javascripts/geo_settings/components/app.vue
+++ b/ee/app/assets/javascripts/geo_settings/components/app.vue
@@ -3,6 +3,8 @@ import { GlLoadingIcon } from '@gitlab/ui';
 // eslint-disable-next-line no-restricted-imports
 import { mapActions, mapState } from 'vuex';
 import { s__ } from '~/locale';
+import { VIEW_ADMIN_GEO_SETTINGS_PAGELOAD } from 'ee/geo_settings/constants';
+import { InternalEvents } from '~/tracking';
 import GeoSettingsForm from './geo_settings_form.vue';
 
 export default {
@@ -17,12 +19,16 @@ export default {
     GlLoadingIcon,
     GeoSettingsForm,
   },
+  mixins: [InternalEvents.mixin()],
   computed: {
     ...mapState(['isLoading']),
   },
   created() {
     this.fetchGeoSettings();
   },
+  mounted() {
+    this.trackEvent(VIEW_ADMIN_GEO_SETTINGS_PAGELOAD);
+  },
   methods: {
     ...mapActions(['fetchGeoSettings']),
   },
diff --git a/ee/app/assets/javascripts/geo_settings/constants.js b/ee/app/assets/javascripts/geo_settings/constants.js
index fe8ca2dec7ea4..409bc5e4f019b 100644
--- a/ee/app/assets/javascripts/geo_settings/constants.js
+++ b/ee/app/assets/javascripts/geo_settings/constants.js
@@ -5,3 +5,5 @@ export const FORM_VALIDATION_FIELDS = {
   TIMEOUT: 'timeout',
   ALLOWED_IP: 'allowedIp',
 };
+
+export const VIEW_ADMIN_GEO_SETTINGS_PAGELOAD = 'view_admin_geo_settings_pageload';
-- 
GitLab