Commit 81f8380e authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '11409-track-onboarding-events-in-snowplow' into 'master'

Resolve "Track onboarding events in Snowplow"

Closes #11409

See merge request gitlab-org/gitlab-ee!14333
parents 387916af 63ce368f
...@@ -2,10 +2,13 @@ ...@@ -2,10 +2,13 @@
import _ from 'underscore'; import _ from 'underscore';
import { mapState, mapActions, mapGetters } from 'vuex'; import { mapState, mapActions, mapGetters } from 'vuex';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
import Stats from 'ee/stats';
import OnboardingHelper from './onboarding_helper.vue'; import OnboardingHelper from './onboarding_helper.vue';
import actionPopoverUtils from './../action_popover_utils'; import actionPopoverUtils from './../action_popover_utils';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
const TRACKING_CATEGORY = 'onboarding';
export default { export default {
components: { components: {
OnboardingHelper, OnboardingHelper,
...@@ -108,6 +111,10 @@ export default { ...@@ -108,6 +111,10 @@ export default {
}, },
handleRestartStep() { handleRestartStep() {
this.showExitTourContent(false); this.showExitTourContent(false);
Stats.trackEvent(TRACKING_CATEGORY, 'click_link', {
label: this.getTrackingLabel(),
property: 'restart_this_step',
});
eventHub.$emit('onboardingHelper.hideActionPopover'); eventHub.$emit('onboardingHelper.hideActionPopover');
}, },
handleSkipStep() { handleSkipStep() {
...@@ -115,6 +122,10 @@ export default { ...@@ -115,6 +122,10 @@ export default {
const { selector } = this.actionPopover; const { selector } = this.actionPopover;
const popoverEl = selector ? document.querySelector(selector) : null; const popoverEl = selector ? document.querySelector(selector) : null;
if (popoverEl) { if (popoverEl) {
Stats.trackEvent(TRACKING_CATEGORY, 'click_link', {
label: this.getTrackingLabel(),
property: 'skip_this_step',
});
popoverEl.click(); popoverEl.click();
} }
} }
...@@ -166,9 +177,20 @@ export default { ...@@ -166,9 +177,20 @@ export default {
return; return;
} }
// show action popover Stats.trackEvent(TRACKING_CATEGORY, 'click_button', {
label: this.getTrackingLabel(),
property: 'got_it',
});
this.showActionPopover(); this.showActionPopover();
}, },
handleShowExitTourContent(showExitTour) {
Stats.trackEvent(TRACKING_CATEGORY, 'click_link', {
label: this.getTrackingLabel(),
property: 'exit_learn_gitlab',
});
this.showExitTourContent(showExitTour);
},
showExitTourContent(showExitTour) { showExitTourContent(showExitTour) {
this.dismissPopover = false; this.dismissPopover = false;
this.showStepContent = true; this.showStepContent = true;
...@@ -184,6 +206,10 @@ export default { ...@@ -184,6 +206,10 @@ export default {
afterAppearHook() { afterAppearHook() {
this.initialShowPopover = true; this.initialShowPopover = true;
}, },
getTrackingLabel() {
const step = this.stepIndex + 1;
return `part_${this.tourKey}_step_${step}`;
},
}, },
}; };
</script> </script>
...@@ -204,7 +230,7 @@ export default { ...@@ -204,7 +230,7 @@ export default {
@clickPopoverButton="handleClickPopoverButton" @clickPopoverButton="handleClickPopoverButton"
@restartStep="handleRestartStep" @restartStep="handleRestartStep"
@skipStep="handleSkipStep" @skipStep="handleSkipStep"
@showExitTourContent="showExitTourContent" @showExitTourContent="handleShowExitTourContent"
@exitTour="handleExitTour" @exitTour="handleExitTour"
/> />
</transition> </transition>
......
.container.container-limited.limit-container-width.navless-container .container.container-limited.limit-container-width.navless-container
#js-onboarding-welcome{ data: { user_avatar_url: avatar_icon_for_user(current_user), project_full_path: @project.web_url, skip_url: root_dashboard_path, from_help_menu: params[:from_help_menu] } } #js-onboarding-welcome{ data: { user_avatar_url: avatar_icon_for_user(current_user), project_full_path: @project.web_url, skip_url: root_dashboard_path(nav_source: "onboarding"), from_help_menu: params[:from_help_menu] } }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment