diff --git a/app/assets/javascripts/super_sidebar/components/global_search/command_palette/constants.js b/app/assets/javascripts/super_sidebar/components/global_search/command_palette/constants.js index 01c66c1ee187c74190b4a2d2d7c4c3c902b37d10..4c592a38656e50a06d4c3cd4b87c49214c2a0d4e 100644 --- a/app/assets/javascripts/super_sidebar/components/global_search/command_palette/constants.js +++ b/app/assets/javascripts/super_sidebar/components/global_search/command_palette/constants.js @@ -56,6 +56,10 @@ export const MODAL_CLOSE_ESC = 'esc'; export const MODAL_CLOSE_BACKGROUND = 'backdrop'; export const MODAL_CLOSE_HEADERCLOSE = 'headerclose'; +export const SCOPE_SEARCH_ALL = 'scoped-in-all'; +export const SCOPE_SEARCH_GROUP = 'scoped-in-group'; +export const SCOPE_SEARCH_PROJECT = 'scoped-in-project'; + export const GROUP_TITLES = { [USER_HANDLE]: USERS_GROUP_TITLE, [PROJECT_HANDLE]: PROJECTS_GROUP_TITLE, diff --git a/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_default_places.vue b/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_default_places.vue index 4413b5db133046afba407a4c0790661b3212b422..551b2a51f3e2865ca8e8da3c7cce8def60ba0f87 100644 --- a/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_default_places.vue +++ b/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_default_places.vue @@ -1,24 +1,39 @@ <script> import { GlDisclosureDropdownGroup } from '@gitlab/ui'; import { kebabCase } from 'lodash'; +import { s__ } from '~/locale'; +import { InternalEvents } from '~/tracking'; import { PLACES } from '~/vue_shared/global_search/constants'; import { TRACKING_UNKNOWN_ID, TRACKING_UNKNOWN_PANEL } from '~/super_sidebar/constants'; +import { + EVENT_CLICK_YOUR_WORK_IN_COMMAND_PALETTE, + EVENT_CLICK_EXPLORE_IN_COMMAND_PALETTE, + EVENT_CLICK_PROFILE_IN_COMMAND_PALETTE, + EVENT_CLICK_PREFERENCES_IN_COMMAND_PALETTE, +} from '~/super_sidebar/components/global_search/tracking_constants'; import { TRACKING_CLICK_COMMAND_PALETTE_ITEM, OVERLAY_CHANGE_CONTEXT, } from '../command_palette/constants'; import SearchResultHoverLayover from './global_search_hover_overlay.vue'; +const trackingMixin = InternalEvents.mixin(); + export default { name: 'DefaultPlaces', i18n: { PLACES, OVERLAY_CHANGE_CONTEXT, + YOUR_WORK_TITLE: s__('GlobalSearch|Your work'), + EXPLORE_TITLE: s__('GlobalSearch|Explore'), + PROFILE_TITLE: s__('GlobalSearch|Profile'), + PREFERENCES_TITLE: s__('GlobalSearch|Preferences'), }, components: { GlDisclosureDropdownGroup, SearchResultHoverLayover, }, + mixins: [trackingMixin], inject: ['contextSwitcherLinks'], computed: { shouldRender() { @@ -61,11 +76,42 @@ export default { this.$emit('nothing-to-render'); } }, + methods: { + trackingTypes({ text }) { + switch (text) { + case this.$options.i18n.YOUR_WORK_TITLE: { + this.trackEvent(EVENT_CLICK_YOUR_WORK_IN_COMMAND_PALETTE); + break; + } + case this.$options.i18n.EXPLORE_TITLE: { + this.trackEvent(EVENT_CLICK_EXPLORE_IN_COMMAND_PALETTE); + break; + } + case this.$options.i18n.PROFILE_TITLE: { + this.trackEvent(EVENT_CLICK_PROFILE_IN_COMMAND_PALETTE); + break; + } + case this.$options.i18n.PREFERENCES_TITLE: { + this.trackEvent(EVENT_CLICK_PREFERENCES_IN_COMMAND_PALETTE); + break; + } + + default: { + /* empty */ + } + } + }, + }, }; </script> <template> - <gl-disclosure-dropdown-group v-if="shouldRender" v-bind="$attrs" :group="group"> + <gl-disclosure-dropdown-group + v-if="shouldRender" + v-bind="$attrs" + :group="group" + @action="trackingTypes" + > <template #list-item="{ item }"> <search-result-hover-layover :text-message="$options.i18n.OVERLAY_CHANGE_CONTEXT"> <span>{{ item.text }}</span> diff --git a/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_scoped_items.vue b/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_scoped_items.vue index f37e604e220f2c250ace6f0ffd58acfd6fe791ac..f85d391051f189c3fb47f87c2036cabc127a297b 100644 --- a/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_scoped_items.vue +++ b/app/assets/javascripts/super_sidebar/components/global_search/components/global_search_scoped_items.vue @@ -2,12 +2,25 @@ import { GlIcon, GlDisclosureDropdownGroup } from '@gitlab/ui'; // eslint-disable-next-line no-restricted-imports import { mapState, mapGetters } from 'vuex'; +import { InternalEvents } from '~/tracking'; import { s__, sprintf } from '~/locale'; import { truncate } from '~/lib/utils/text_utility'; -import { OVERLAY_SEARCH } from '../command_palette/constants'; +import { + EVENT_CLICK_ALL_GITLAB_SCOPED_SEARCH_TO_ADVANCED_SEARCH, + EVENT_CLICK_GROUP_SCOPED_SEARCH_TO_ADVANCED_SEARCH, + EVENT_CLICK_PROJECT_SCOPED_SEARCH_TO_ADVANCED_SEARCH, +} from '~/super_sidebar/components/global_search/tracking_constants'; +import { + OVERLAY_SEARCH, + SCOPE_SEARCH_ALL, + SCOPE_SEARCH_GROUP, + SCOPE_SEARCH_PROJECT, +} from '../command_palette/constants'; import { SCOPE_TOKEN_MAX_LENGTH } from '../constants'; import SearchResultHoverLayover from './global_search_hover_overlay.vue'; +const trackingMixin = InternalEvents.mixin(); + export default { name: 'GlobalSearchScopedItems', components: { @@ -15,6 +28,7 @@ export default { GlDisclosureDropdownGroup, SearchResultHoverLayover, }, + mixins: [trackingMixin], i18n: { OVERLAY_SEARCH, }, @@ -44,14 +58,36 @@ export default { getTruncatedScope(scope) { return truncate(scope, SCOPE_TOKEN_MAX_LENGTH); }, + trackingTypes({ text }) { + switch (text) { + case this.$options.SCOPE_SEARCH_ALL: { + this.trackEvent(EVENT_CLICK_ALL_GITLAB_SCOPED_SEARCH_TO_ADVANCED_SEARCH); + break; + } + case this.$options.SCOPE_SEARCH_GROUP: { + this.trackEvent(EVENT_CLICK_GROUP_SCOPED_SEARCH_TO_ADVANCED_SEARCH); + break; + } + case this.$options.SCOPE_SEARCH_PROJECT: { + this.trackEvent(EVENT_CLICK_PROJECT_SCOPED_SEARCH_TO_ADVANCED_SEARCH); + break; + } + default: { + /* empty */ + } + } + }, }, + SCOPE_SEARCH_ALL, + SCOPE_SEARCH_GROUP, + SCOPE_SEARCH_PROJECT, }; </script> <template> <div> - <ul class="gl-m-0 gl-p-0 gl-pb-2 gl-list-none" data-testid="scoped-items"> - <gl-disclosure-dropdown-group :group="group" bordered> + <ul class="gl-m-0 gl-p-0 gl-pb-2 gl-list-style-none" data-testid="scoped-items"> + <gl-disclosure-dropdown-group :group="group" bordered @action="trackingTypes"> <template #list-item="{ item }"> <search-result-hover-layover :text-message="$options.i18n.OVERLAY_SEARCH"> <gl-icon diff --git a/app/assets/javascripts/super_sidebar/components/global_search/tracking_constants.js b/app/assets/javascripts/super_sidebar/components/global_search/tracking_constants.js index bd5e3d57a2bfa2cb0dde593798ade739cc98c7d4..28cef61e59ebb728ec391c0f6edb69af94831010 100644 --- a/app/assets/javascripts/super_sidebar/components/global_search/tracking_constants.js +++ b/app/assets/javascripts/super_sidebar/components/global_search/tracking_constants.js @@ -8,3 +8,14 @@ export const EVENT_CLICK_MERGE_REQUESTS_THAT_IM_A_REVIEWER_IN_COMMAND_PALETTE = 'click_merge_requests_that_im_a_reviewer_in_command_palette'; export const EVENT_CLICK_MERGE_REQUESTS_I_CREATED_IN_COMMAND_PALETTE = 'click_merge_requests_i_created_in_command_palette'; +export const EVENT_CLICK_YOUR_WORK_IN_COMMAND_PALETTE = 'click_your_work_in_command_palette'; +export const EVENT_CLICK_EXPLORE_IN_COMMAND_PALETTE = 'click_explore_in_command_palette'; +export const EVENT_CLICK_PROFILE_IN_COMMAND_PALETTE = 'click_profile_in_command_palette'; +export const EVENT_CLICK_PREFERENCES_IN_COMMAND_PALETTE = 'click_preferences_in_command_palette'; + +export const EVENT_CLICK_ALL_GITLAB_SCOPED_SEARCH_TO_ADVANCED_SEARCH = + 'click_all_gitlab_scoped_search_to_advanced_search'; +export const EVENT_CLICK_GROUP_SCOPED_SEARCH_TO_ADVANCED_SEARCH = + 'click_group_scoped_search_to_advanced_search'; +export const EVENT_CLICK_PROJECT_SCOPED_SEARCH_TO_ADVANCED_SEARCH = + 'click_project_scoped_search_to_advanced_search'; diff --git a/config/events/click_all_gitlab_scoped_search_to_advanced_search.yml b/config/events/click_all_gitlab_scoped_search_to_advanced_search.yml new file mode 100644 index 0000000000000000000000000000000000000000..3fd16dea7ecfa36bbf6562bec4c3d5230870537e --- /dev/null +++ b/config/events/click_all_gitlab_scoped_search_to_advanced_search.yml @@ -0,0 +1,17 @@ +--- +description: User clicks "in all GitLab" in command palette +internal_events: true +action: click_all_gitlab_scoped_search_to_advanced_search +identifiers: +- namespace +- user +product_group: global_search +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate diff --git a/config/events/click_explore_in_command_palette.yml b/config/events/click_explore_in_command_palette.yml new file mode 100644 index 0000000000000000000000000000000000000000..6494a878f71bee1bd601229531e537b76d4df3a1 --- /dev/null +++ b/config/events/click_explore_in_command_palette.yml @@ -0,0 +1,17 @@ +--- +description: User clicks "Explore" in Places +internal_events: true +action: click_explore_in_command_palette +identifiers: +- namespace +- user +product_group: global_search +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate diff --git a/config/events/click_group_scoped_search_to_advanced_search.yml b/config/events/click_group_scoped_search_to_advanced_search.yml new file mode 100644 index 0000000000000000000000000000000000000000..1fbc0d0d6f5e6b247f96e92918ce1feb6cc86e5f --- /dev/null +++ b/config/events/click_group_scoped_search_to_advanced_search.yml @@ -0,0 +1,17 @@ +--- +description: User clicks group search scope when option is visible +internal_events: true +action: click_group_scoped_search_to_advanced_search +identifiers: +- namespace +- user +product_group: global_search +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate diff --git a/config/events/click_preferences_in_command_palette.yml b/config/events/click_preferences_in_command_palette.yml new file mode 100644 index 0000000000000000000000000000000000000000..e71b603accb3462c8cf0ae2ea4329b83b547d586 --- /dev/null +++ b/config/events/click_preferences_in_command_palette.yml @@ -0,0 +1,17 @@ +--- +description: User clicks "Preferences" in Places +internal_events: true +action: click_preferences_in_command_palette +identifiers: +- namespace +- user +product_group: global_search +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate diff --git a/config/events/click_profile_in_command_palette.yml b/config/events/click_profile_in_command_palette.yml new file mode 100644 index 0000000000000000000000000000000000000000..5b31a01ffa44930df179c36fbb350ef1b42260d5 --- /dev/null +++ b/config/events/click_profile_in_command_palette.yml @@ -0,0 +1,17 @@ +--- +description: User clicks "Profile" in Places +internal_events: true +action: click_profile_in_command_palette +identifiers: +- namespace +- user +product_group: global_search +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate diff --git a/config/events/click_project_scoped_search_to_advanced_search.yml b/config/events/click_project_scoped_search_to_advanced_search.yml new file mode 100644 index 0000000000000000000000000000000000000000..7b330607485bdf1e9d65af18f48e0924580838d1 --- /dev/null +++ b/config/events/click_project_scoped_search_to_advanced_search.yml @@ -0,0 +1,17 @@ +--- +description: User searches in project scope when option is available +internal_events: true +action: click_project_scoped_search_to_advanced_search +identifiers: +- namespace +- user +product_group: global_search +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate diff --git a/config/events/click_your_work_in_command_palette.yml b/config/events/click_your_work_in_command_palette.yml new file mode 100644 index 0000000000000000000000000000000000000000..f8ddc7ff030eed0fa5822c78d7641a68fd509ccb --- /dev/null +++ b/config/events/click_your_work_in_command_palette.yml @@ -0,0 +1,17 @@ +--- +description: User clicks "Your work" in Places +internal_events: true +action: click_your_work_in_command_palette +identifiers: +- namespace +- user +product_group: global_search +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..6607a9afdfe5e1f2e2b4ee61505881a1f8b0c9ad --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_monthly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_monthly +description: Monthly count of unique users clicks "in all GitLab" in command palette +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 28d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_all_gitlab_scoped_search_to_advanced_search + unique: user.id diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_click_explore_in_command_palette_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_click_explore_in_command_palette_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..c9ac4a6e75d07ff00acdaa70c60bad50b32f4678 --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_click_explore_in_command_palette_monthly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_explore_in_command_palette_monthly +description: Monthly count of unique users User clicks "Explore" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 28d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_explore_in_command_palette + unique: user.id diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..4f60af204116b730c1b06f53188137523ded4c45 --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_monthly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_monthly +description: Monthly count of unique users User clicks group search scope when option is visible +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 28d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_group_scoped_search_to_advanced_search + unique: user.id diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_click_preferences_in_command_palette_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_click_preferences_in_command_palette_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..2baec9907888113906958824ea015c08a6849b78 --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_click_preferences_in_command_palette_monthly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_preferences_in_command_palette_monthly +description: Monthly count of unique users User clicks "Preferences" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 28d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_preferences_in_command_palette + unique: user.id diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_click_profile_in_command_palette_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_click_profile_in_command_palette_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..b6c982f4c982dbc2f8f207c93ad4bfbdfdc0ad79 --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_click_profile_in_command_palette_monthly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_profile_in_command_palette_monthly +description: Monthly count of unique users User clicks "Profile" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 28d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_profile_in_command_palette + unique: user.id diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..9a5136849a09d3fe950928f31fa44e8722402404 --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_monthly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_monthly +description: Monthly count of unique users User searches in project scope when option is available +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 28d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_project_scoped_search_to_advanced_search + unique: user.id diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_click_your_work_in_command_palette_monthly.yml b/config/metrics/counts_28d/count_distinct_user_id_from_click_your_work_in_command_palette_monthly.yml new file mode 100644 index 0000000000000000000000000000000000000000..791a8aa414318307bb05cec7397a7540ac7099c1 --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_click_your_work_in_command_palette_monthly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_your_work_in_command_palette_monthly +description: Monthly count of unique users User clicks "Your work" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 28d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_your_work_in_command_palette + unique: user.id diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..ec5456cbd2ff4e91712dc19076a1efa52b98531e --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_weekly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_all_gitlab_scoped_search_to_advanced_search_weekly +description: Weekly count of unique users who click "in all GitLab" in command palette +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 7d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_all_gitlab_scoped_search_to_advanced_search + unique: user.id diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_click_explore_in_command_palette_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_click_explore_in_command_palette_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..fe9f4473a34570882a458d15ff6d4c8b2b910014 --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_click_explore_in_command_palette_weekly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_explore_in_command_palette_weekly +description: Weekly count of unique users who click "Explore" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 7d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_explore_in_command_palette + unique: user.id diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..bdbe5859a785873df60cb45c0b5188011a5b4c83 --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_weekly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_group_scoped_search_to_advanced_search_weekly +description: Weekly count of unique users who click group search scope when option is visible +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 7d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_group_scoped_search_to_advanced_search + unique: user.id diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_click_preferences_in_command_palette_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_click_preferences_in_command_palette_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..8525afb5bdd4abfc44e86d4c5851f6bf424fd203 --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_click_preferences_in_command_palette_weekly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_preferences_in_command_palette_weekly +description: Weekly count of unique users who click "Preferences" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 7d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_preferences_in_command_palette + unique: user.id diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_click_profile_in_command_palette_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_click_profile_in_command_palette_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..f79c2dd2a13fa539f48102d1a396af65df2544ab --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_click_profile_in_command_palette_weekly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_profile_in_command_palette_weekly +description: Weekly count of unique users who click "Profile" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 7d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_profile_in_command_palette + unique: user.id diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..f62ac267bf9a68d963451a4b65c56348599de9f2 --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_weekly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_project_scoped_search_to_advanced_search_weekly +description: Weekly count of unique users who search in project scope when option is available +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 7d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_project_scoped_search_to_advanced_search + unique: user.id diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_click_your_work_in_command_palette_weekly.yml b/config/metrics/counts_7d/count_distinct_user_id_from_click_your_work_in_command_palette_weekly.yml new file mode 100644 index 0000000000000000000000000000000000000000..aae3f462a56fa6b0d2eae1b6b2cc85f9497f39d0 --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_click_your_work_in_command_palette_weekly.yml @@ -0,0 +1,22 @@ +--- +key_path: redis_hll_counters.count_distinct_user_id_from_click_your_work_in_command_palette_weekly +description: Weekly count of unique users who click "Your work" in Places +product_group: global_search +performance_indicator_type: [] +value_type: number +status: active +milestone: '17.1' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/154395 +time_frame: 7d +data_source: internal_events +data_category: optional +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +events: +- name: click_your_work_in_command_palette + unique: user.id diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 0b50f1e4b8c38495e0ff2ae4bc98d32d8792aa1e..bd9910425c55b4b6bcc5c818ec82c93da325e48a 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -23933,6 +23933,9 @@ msgstr "" msgid "GlobalSearch|Commands %{link1Start}⌘%{link1End} %{link2Start}k%{link2End}" msgstr "" +msgid "GlobalSearch|Explore" +msgstr "" + msgid "GlobalSearch|Fetching aggregations error." msgstr "" @@ -24026,6 +24029,12 @@ msgstr "" msgid "GlobalSearch|Places" msgstr "" +msgid "GlobalSearch|Preferences" +msgstr "" + +msgid "GlobalSearch|Profile" +msgstr "" + msgid "GlobalSearch|Project" msgstr "" @@ -24125,6 +24134,9 @@ msgstr "" msgid "GlobalSearch|What are you searching for?" msgstr "" +msgid "GlobalSearch|Your work" +msgstr "" + msgid "GlobalSearch|all GitLab" msgstr "" diff --git a/spec/frontend/super_sidebar/components/global_search/components/global_search_default_places_spec.js b/spec/frontend/super_sidebar/components/global_search/components/global_search_default_places_spec.js index 8aa2b8ecdcd1895985d225ef9da9284ccdc56ae3..c7982759ca83e8136f297f31b4b7d7a6d91281aa 100644 --- a/spec/frontend/super_sidebar/components/global_search/components/global_search_default_places_spec.js +++ b/spec/frontend/super_sidebar/components/global_search/components/global_search_default_places_spec.js @@ -2,6 +2,13 @@ import { GlDisclosureDropdownGroup, GlDisclosureDropdownItem } from '@gitlab/ui' import { shallowMount } from '@vue/test-utils'; import GlobalSearchDefaultPlaces from '~/super_sidebar/components/global_search/components/global_search_default_places.vue'; import SearchResultHoverLayover from '~/super_sidebar/components/global_search/components/global_search_hover_overlay.vue'; +import { + EVENT_CLICK_YOUR_WORK_IN_COMMAND_PALETTE, + EVENT_CLICK_EXPLORE_IN_COMMAND_PALETTE, + EVENT_CLICK_PROFILE_IN_COMMAND_PALETTE, + EVENT_CLICK_PREFERENCES_IN_COMMAND_PALETTE, +} from '~/super_sidebar/components/global_search/tracking_constants'; +import { useMockInternalEventsTracking } from 'helpers/tracking_internal_events_helper'; import { contextSwitcherLinks } from '../../../mock_data'; describe('GlobalSearchDefaultPlaces', () => { @@ -112,5 +119,21 @@ describe('GlobalSearchDefaultPlaces', () => { it('renders the layover component', () => { expect(findLayover().exists()).toBe(true); }); + + describe('tracking', () => { + const { bindInternalEventDocument } = useMockInternalEventsTracking(); + + it.each` + action | event + ${'Your work'} | ${EVENT_CLICK_YOUR_WORK_IN_COMMAND_PALETTE} + ${'Explore'} | ${EVENT_CLICK_EXPLORE_IN_COMMAND_PALETTE} + ${'Profile'} | ${EVENT_CLICK_PROFILE_IN_COMMAND_PALETTE} + ${'Preferences'} | ${EVENT_CLICK_PREFERENCES_IN_COMMAND_PALETTE} + `("triggers tracking event '$event' after emiting action '$action'", ({ action, event }) => { + const { trackEventSpy } = bindInternalEventDocument(wrapper.element); + findGroup().vm.$emit('action', { text: action }); + expect(trackEventSpy).toHaveBeenCalledWith(event, {}, undefined); + }); + }); }); }); diff --git a/spec/frontend/super_sidebar/components/global_search/components/global_search_scoped_items_spec.js b/spec/frontend/super_sidebar/components/global_search/components/global_search_scoped_items_spec.js index dfe32897131d8f371d1dd6a3f2a97636f3b7f212..1e1516989f6551310ed00281bdb594a9f2aadbd3 100644 --- a/spec/frontend/super_sidebar/components/global_search/components/global_search_scoped_items_spec.js +++ b/spec/frontend/super_sidebar/components/global_search/components/global_search_scoped_items_spec.js @@ -5,6 +5,17 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { trimText } from 'helpers/text_helper'; import GlobalSearchScopedItems from '~/super_sidebar/components/global_search/components/global_search_scoped_items.vue'; +import { useMockInternalEventsTracking } from 'helpers/tracking_internal_events_helper'; +import { + EVENT_CLICK_ALL_GITLAB_SCOPED_SEARCH_TO_ADVANCED_SEARCH, + EVENT_CLICK_GROUP_SCOPED_SEARCH_TO_ADVANCED_SEARCH, + EVENT_CLICK_PROJECT_SCOPED_SEARCH_TO_ADVANCED_SEARCH, +} from '~/super_sidebar/components/global_search/tracking_constants'; +import { + SCOPE_SEARCH_ALL, + SCOPE_SEARCH_GROUP, + SCOPE_SEARCH_PROJECT, +} from '~/super_sidebar/components/global_search/command_palette/constants'; import { MOCK_SEARCH, MOCK_SCOPED_SEARCH_GROUP, @@ -41,6 +52,7 @@ describe('GlobalSearchScopedItems', () => { }); }; + const findGroup = () => wrapper.findComponent(GlDisclosureDropdownGroup); const findItems = () => wrapper.findAllComponents(GlDisclosureDropdownItem); const findItemsText = () => findItems().wrappers.map((w) => trimText(w.text())); const findItemLinks = () => findItems().wrappers.map((w) => w.find('a').attributes('href')); @@ -66,5 +78,20 @@ describe('GlobalSearchScopedItems', () => { const expectedLinks = MOCK_SCOPED_SEARCH_GROUP.items.map((o) => o.href); expect(findItemLinks()).toStrictEqual(expectedLinks); }); + + describe('tracking', () => { + const { bindInternalEventDocument } = useMockInternalEventsTracking(); + + it.each` + action | event + ${SCOPE_SEARCH_ALL} | ${EVENT_CLICK_ALL_GITLAB_SCOPED_SEARCH_TO_ADVANCED_SEARCH} + ${SCOPE_SEARCH_GROUP} | ${EVENT_CLICK_GROUP_SCOPED_SEARCH_TO_ADVANCED_SEARCH} + ${SCOPE_SEARCH_PROJECT} | ${EVENT_CLICK_PROJECT_SCOPED_SEARCH_TO_ADVANCED_SEARCH} + `("triggers tracking event '$event' after emiting action '$action'", ({ action, event }) => { + const { trackEventSpy } = bindInternalEventDocument(wrapper.element); + findGroup().vm.$emit('action', { text: action }); + expect(trackEventSpy).toHaveBeenCalledWith(event, {}, undefined); + }); + }); }); });