diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-22 00:10:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-22 00:10:01 +0300 |
commit | 7f6fde499f38807283ab99a6714f76d829be1907 (patch) | |
tree | 954c9a098a57eae964b563bf3a0e295649d41d6d /app | |
parent | 77d6584e99881088ada2078703e1501c629aea54 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue | 36 | ||||
-rw-r--r-- | app/views/dashboard/projects/index.html.haml | 3 |
2 files changed, 38 insertions, 1 deletions
diff --git a/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue b/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue index 6b907f31a37..9fa441348c7 100644 --- a/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue +++ b/app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue @@ -2,11 +2,15 @@ import { GlBanner } from '@gitlab/ui'; import { s__ } from '~/locale'; import axios from '~/lib/utils/axios_utils'; +import Tracking from '~/tracking'; + +const trackingMixin = Tracking.mixin(); export default { components: { GlBanner, }, + mixins: [trackingMixin], inject: { svgPath: { default: '', @@ -20,6 +24,9 @@ export default { calloutsFeatureId: { default: '', }, + trackLabel: { + default: '', + }, }, i18n: { title: s__('CustomizeHomepageBanner|Do you want to customize this page?'), @@ -31,8 +38,19 @@ export default { data() { return { visible: true, + tracking: { + label: this.trackLabel, + }, }; }, + created() { + this.$nextTick(() => { + this.addTrackingAttributesToButton(); + }); + }, + mounted() { + this.trackOnShow(); + }, methods: { handleClose() { axios @@ -45,6 +63,23 @@ export default { }); this.visible = false; + this.track('click_dismiss'); + }, + trackOnShow() { + if (this.visible) this.track('show_home_page_banner'); + }, + addTrackingAttributesToButton() { + // we can't directly add these on the button like we need to due to + // button not being modifiable currently + // https://gitlab.com/gitlab-org/gitlab-ui/-/blob/9209ec424e5cca14bc8a1b5c9fa12636d8c83dad/src/components/base/banner/banner.vue#L60 + const button = this.$refs.banner.$el.querySelector( + `[href='${this.preferencesBehaviorPath}']`, + ); + + if (button) { + button.setAttribute('data-track-event', 'click_go_to_preferences'); + button.setAttribute('data-track-label', this.trackLabel); + } }, }, }; @@ -53,6 +88,7 @@ export default { <template> <gl-banner v-if="visible" + ref="banner" :title="$options.i18n.title" :button-text="$options.i18n.button_text" :button-link="preferencesBehaviorPath" diff --git a/app/views/dashboard/projects/index.html.haml b/app/views/dashboard/projects/index.html.haml index 54a5624c6dd..e8d5929442e 100644 --- a/app/views/dashboard/projects/index.html.haml +++ b/app/views/dashboard/projects/index.html.haml @@ -9,7 +9,8 @@ .js-customize-homepage-banner{ data: { svg_path: image_path('illustrations/monitoring/getting_started.svg'), preferences_behavior_path: profile_preferences_path(anchor: 'behavior'), callouts_path: user_callouts_path, - callouts_feature_id: UserCalloutsHelper::CUSTOMIZE_HOMEPAGE } } + callouts_feature_id: UserCalloutsHelper::CUSTOMIZE_HOMEPAGE, + track_label: 'home_page' } } = render_dashboard_gold_trial(current_user) |