From c884f327c8500fd8610ec0526b032f8f98cb5d15 Mon Sep 17 00:00:00 2001 From: Malcolm Bouzi Date: Thu, 18 Nov 2021 15:23:56 -0500 Subject: [PATCH] web/satellite: add new events to segment We'd like more data to help us figure out drop off points. Change-Id: Ida624188b76d14e6349afb48e72a12a52553e61d --- web/satellite/src/components/browser/FileBrowser.vue | 6 ++++++ .../components/onboardingTour/steps/cliFlow/APIKey.vue | 8 +++++++- web/satellite/src/utils/constants/analyticsEventNames.ts | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/web/satellite/src/components/browser/FileBrowser.vue b/web/satellite/src/components/browser/FileBrowser.vue index eedd9a596..e57a844b0 100644 --- a/web/satellite/src/components/browser/FileBrowser.vue +++ b/web/satellite/src/components/browser/FileBrowser.vue @@ -449,7 +449,10 @@ import FileEntry from "./FileEntry.vue"; import BreadCrumbs from "./BreadCrumbs.vue"; import FileModal from "./FileModal.vue"; import FileShareModal from "./FileShareModal.vue"; + +import { AnalyticsHttpApi } from '@/api/analytics'; import { BrowserFile } from "@/types/browser.ts"; +import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames'; // @vue/component @Component({ @@ -467,6 +470,8 @@ export default class FileBrowser extends Vue { public deleteConfirmation = false; public fetchingFilesSpinner = false; + private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); + /** * Check if the s3 client has been initialized in the store. */ @@ -687,6 +692,7 @@ export default class FileBrowser extends Vue { */ public async upload(e: Event): Promise { await this.$store.dispatch("files/upload", e); + this.analytics.eventTriggered(AnalyticsEvent.OBJECT_UPLOADED); const target = e.target as HTMLInputElement; target.value = ""; } diff --git a/web/satellite/src/components/onboardingTour/steps/cliFlow/APIKey.vue b/web/satellite/src/components/onboardingTour/steps/cliFlow/APIKey.vue index a2b095d0d..7ec87d96c 100644 --- a/web/satellite/src/components/onboardingTour/steps/cliFlow/APIKey.vue +++ b/web/satellite/src/components/onboardingTour/steps/cliFlow/APIKey.vue @@ -28,6 +28,8 @@ import { Component, Vue } from 'vue-property-decorator'; import { RouteConfig } from "@/router"; import { MetaUtils } from "@/utils/meta"; +import { AnalyticsEvent } from "@/utils/constants/analyticsEventNames"; +import { AnalyticsHttpApi } from "@/api/analytics"; import {ACCESS_GRANTS_ACTIONS} from "@/store/modules/accessGrants"; import {APP_STATE_MUTATIONS} from "@/store/mutationConstants"; @@ -50,6 +52,8 @@ import Icon from '@/../static/images/onboardingTour/apiKeyStep.svg'; export default class APIKey extends Vue { private worker: Worker; + private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); + public satelliteAddress: string = MetaUtils.getMetaContent('satellite-nodeurl'); public isLoading = true; public restrictedKey = ''; @@ -87,6 +91,8 @@ export default class APIKey extends Vue { try { this.restrictedKey = await this.generateRestrictedKey(); + this.analytics.eventTriggered(AnalyticsEvent.API_KEY_GENERATED); + await this.$store.commit(APP_STATE_MUTATIONS.SET_ONB_API_KEY, this.restrictedKey); } catch (error) { await this.$notify.error(error.message) @@ -177,4 +183,4 @@ export default class APIKey extends Vue { margin: 20px 0; } } - \ No newline at end of file + diff --git a/web/satellite/src/utils/constants/analyticsEventNames.ts b/web/satellite/src/utils/constants/analyticsEventNames.ts index 5565bb1c3..f4ff8dda0 100644 --- a/web/satellite/src/utils/constants/analyticsEventNames.ts +++ b/web/satellite/src/utils/constants/analyticsEventNames.ts @@ -8,4 +8,6 @@ export enum AnalyticsEvent { EXTERNAL_LINK_CLICKED = 'External Link Clicked', PATH_SELECTED = 'Path Selected', LINK_SHARED = 'Link Shared', + OBJECT_UPLOADED = 'Object Uploaded', + API_KEY_GENERATED = 'API Key Generated', }