From 613a95530be0d3725b99f83124db433ade2c5848 Mon Sep 17 00:00:00 2001 From: prerna-parashar <78053555+prerna-parashar@users.noreply.github.com> Date: Mon, 19 Apr 2021 09:44:25 -0700 Subject: [PATCH] satellite/analytics: Add analytics for "path selected" in onboarding step (#4086) --- satellite/analytics/service.go | 3 +- .../onboardingTour/steps/OverviewStep.vue | 42 +++++++++++++++++-- .../utils/constants/analyticsEventNames.ts | 1 + 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/satellite/analytics/service.go b/satellite/analytics/service.go index 8318e8327..ab9a0f8aa 100644 --- a/satellite/analytics/service.go +++ b/satellite/analytics/service.go @@ -19,6 +19,7 @@ const ( eventGatewayCredentialsCreated = "Credentials Created" eventPassphraseCreated = "Passphrase Created" eventExternalLinkClicked = "External Link Clicked" + eventPathSelected = "Path Selected" ) // Config is a configuration struct for analytics Service. @@ -50,7 +51,7 @@ func NewService(log *zap.Logger, config Config, satelliteName string) *Service { if config.Enabled { service.segment = segment.New(config.SegmentWriteKey) } - for _, name := range []string{eventGatewayCredentialsCreated, eventPassphraseCreated, eventExternalLinkClicked} { + for _, name := range []string{eventGatewayCredentialsCreated, eventPassphraseCreated, eventExternalLinkClicked, eventPathSelected} { service.clientEvents[name] = true } return service diff --git a/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue b/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue index 7f657bf90..516d34b02 100644 --- a/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue +++ b/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue @@ -36,7 +36,7 @@ class="overview-area__path-section__button" label="Continue" width="calc(100% - 4px)" - :on-press="onCreateGrantClick" + :on-press="onGatewayMTClick" :is-blue-white="true" :is-disabled="isLoading" /> @@ -50,7 +50,7 @@ class="overview-area__path-section__button" label="Continue" width="calc(100% - 4px)" - :on-press="onCreateGrantClick" + :on-press="onUplinkCLIClick" :is-blue-white="true" :is-disabled="isLoading" /> @@ -65,6 +65,7 @@ href="https://docs.storj.io/how-tos/sync-files-with-rclone" target="_blank" rel="noopener noreferrer" + @click="onRcloneClick" > Continue @@ -95,6 +96,8 @@ import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; import { PROJECTS_ACTIONS } from '@/store/modules/projects'; import { ProjectFields } from '@/types/projects'; import { PM_ACTIONS } from '@/utils/constants/actionNames'; +import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; +import { AnalyticsHttpApi } from '@/api/analytics'; @Component({ components: { @@ -105,6 +108,12 @@ import { PM_ACTIONS } from '@/utils/constants/actionNames'; export default class OverviewStep extends Vue { public isLoading: boolean = false; + private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); + + public onRcloneClick(): void { + this.analytics.linkEventTriggered(AnalyticsEvent.PATH_SELECTED, "Rclone Sync"); + } + /** * Lifecycle hook after initial render. * Sets area to needed state. @@ -125,11 +134,36 @@ export default class OverviewStep extends Vue { * Holds button click logic. * Creates untitled project and redirects to next step (creating access grant). */ - public async onCreateGrantClick(): Promise { + public async onGatewayMTClick(): Promise { if (this.isLoading) return; this.isLoading = true; + await this.analytics.linkEventTriggered(AnalyticsEvent.PATH_SELECTED, "GatewayMT"); + + try { + await this.createUntitledProject(); + + this.isLoading = false; + + await this.$router.push(RouteConfig.OnboardingTour.with(RouteConfig.AccessGrant).with(RouteConfig.AccessGrantName).path); + } catch (error) { + await this.$notify.error(error.message); + this.isLoading = false; + } + } + + /** + * Holds button click logic. + * Creates untitled project and redirects to next step (creating access grant). + */ + public async onUplinkCLIClick(): Promise { + if (this.isLoading) return; + + this.isLoading = true; + + await this.analytics.linkEventTriggered(AnalyticsEvent.PATH_SELECTED, "CLI"); + try { await this.createUntitledProject(); @@ -150,6 +184,8 @@ export default class OverviewStep extends Vue { this.isLoading = true; + await this.analytics.linkEventTriggered(AnalyticsEvent.PATH_SELECTED, "Continue in Browser"); + try { await this.createUntitledProject(); diff --git a/web/satellite/src/utils/constants/analyticsEventNames.ts b/web/satellite/src/utils/constants/analyticsEventNames.ts index accb222f3..e635dade1 100644 --- a/web/satellite/src/utils/constants/analyticsEventNames.ts +++ b/web/satellite/src/utils/constants/analyticsEventNames.ts @@ -6,4 +6,5 @@ export enum AnalyticsEvent { GATEWAY_CREDENTIALS_CREATED = 'Credentials Created', PASSPHRASE_CREATED = 'Passphrase Created', EXTERNAL_LINK_CLICKED = 'External Link Clicked', + PATH_SELECTED = 'Path Selected', }