Skip to content
代码片段 群组 项目
未验证 提交 86f9f7f6 编辑于 作者: Lukas 'ai-pi' Eipert's avatar Lukas 'ai-pi' Eipert 提交者: GitLab
浏览文件

Merge branch '438845-improve-command-palette-metrics-tracking-4' into 'master'

No related branches found
No related tags found
无相关合并请求
显示
418 个添加4 个删除
......@@ -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,
......
<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>
......
......@@ -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
......
......@@ -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';
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
---
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
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册