From c4a950a40ca38cc9dddee9c4bee65ffbb94b4c58 Mon Sep 17 00:00:00 2001 From: Moby von Briesen Date: Fri, 26 Mar 2021 19:14:02 +0100 Subject: [PATCH] web/satellite: Remove client-side Segment analytics We can be more precise and conservative by using the backend satellite/analytics service. We also no longer need client-side Segment scripts. Change-Id: Ic5fb18bea2d388b586ad773e26027d69bde87294 --- satellite/console/consoleweb/server.go | 3 - scripts/testdata/satellite-config.yaml.lock | 3 - web/satellite/index.html | 1 - web/satellite/package-lock.json | 6 -- web/satellite/package.json | 1 - web/satellite/src/App.vue | 4 -- .../accessGrants/steps/NameStep.vue | 5 -- .../components/account/DeleteAccountPopup.vue | 5 -- .../PeriodSelection.vue | 13 +---- .../UsageAndChargesItem.vue | 7 --- .../billing/paymentMethods/AddCardForm.vue | 8 --- .../billing/paymentMethods/AddStorjForm.vue | 5 -- .../billing/paymentMethods/PaymentMethods.vue | 4 -- .../onboardingTour/steps/OverviewStep.vue | 5 -- .../steps/paymentStates/AddCardState.vue | 10 +--- .../steps/paymentStates/AddStorjState.vue | 7 +-- .../tokenSubSteps/PayingStep.vue | 7 +-- .../src/components/project/CreateProject.vue | 4 -- .../components/project/DeleteProjectPopup.vue | 5 -- .../components/project/ProjectDashboard.vue | 6 -- .../src/components/team/AddUserPopup.vue | 6 -- .../components/team/ProjectMembersArea.vue | 5 -- web/satellite/src/main.ts | 3 - web/satellite/src/types/plugins.ts | 2 - .../utils/constants/analyticsEventNames.ts | 21 ------- web/satellite/src/utils/plugins/segment.ts | 58 ------------------- web/satellite/src/views/login/LoginArea.vue | 4 -- .../src/views/register/RegisterArea.vue | 13 ----- .../paymentMethods/AddStorjForm.spec.ts | 3 - .../paymentMethods/PaymentMethods.spec.ts | 3 - .../tokenSubSteps/PayingStep.spec.ts | 3 - .../unit/project/ProjectDashboard.spec.ts | 3 - .../projectMembers/ProjectMembersArea.spec.ts | 3 - .../tests/unit/views/DashboardArea.spec.ts | 3 - web/satellite/tsconfig.json | 3 +- 35 files changed, 5 insertions(+), 237 deletions(-) delete mode 100644 web/satellite/src/utils/plugins/segment.ts diff --git a/satellite/console/consoleweb/server.go b/satellite/console/consoleweb/server.go index b3ef8131d..17ba190e4 100644 --- a/satellite/console/consoleweb/server.go +++ b/satellite/console/consoleweb/server.go @@ -75,7 +75,6 @@ type Config struct { SatelliteName string `help:"used to display at web satellite console" default:"Storj"` SatelliteOperator string `help:"name of organization which set up satellite" default:"Storj Labs" ` TermsAndConditionsURL string `help:"url link to terms and conditions page" default:"https://storj.io/storage-sla/"` - SegmentIOPublicKey string `help:"used to initialize segment.io at web satellite console" default:""` AccountActivationRedirectURL string `help:"url link for account activation redirect" default:""` VerificationPageURL string `help:"url link to sign up verification page" devDefault:"" releaseDefault:"https://tardigrade.io/verify"` PartneredSatelliteNames string `help:"names of partnered satellites" default:"US-Central-1,Europe-West-1,Asia-East-1"` @@ -298,7 +297,6 @@ func (server *Server) appHandler(w http.ResponseWriter, r *http.Request) { ExternalAddress string SatelliteName string SatelliteNodeURL string - SegmentIOPublicKey string StripePublicKey string VerificationPageURL string PartneredSatelliteNames string @@ -318,7 +316,6 @@ func (server *Server) appHandler(w http.ResponseWriter, r *http.Request) { data.ExternalAddress = server.config.ExternalAddress data.SatelliteName = server.config.SatelliteName data.SatelliteNodeURL = server.nodeURL.String() - data.SegmentIOPublicKey = server.config.SegmentIOPublicKey data.StripePublicKey = server.stripePublicKey data.VerificationPageURL = server.config.VerificationPageURL data.PartneredSatelliteNames = server.config.PartneredSatelliteNames diff --git a/scripts/testdata/satellite-config.yaml.lock b/scripts/testdata/satellite-config.yaml.lock index f3b5bc09c..32f7d9123 100755 --- a/scripts/testdata/satellite-config.yaml.lock +++ b/scripts/testdata/satellite-config.yaml.lock @@ -148,9 +148,6 @@ compensation.withheld-percents: 75,75,75,50,50,50,25,25,25,0,0,0,0,0,0 # name of organization which set up satellite # console.satellite-operator: Storj Labs -# used to initialize segment.io at web satellite console -# console.segment-io-public-key: "" - # used to communicate with web crawlers and other web robots # console.seo: "User-agent: *\nDisallow: \nDisallow: /cgi-bin/" diff --git a/web/satellite/index.html b/web/satellite/index.html index 95488d52a..9424ead01 100644 --- a/web/satellite/index.html +++ b/web/satellite/index.html @@ -6,7 +6,6 @@ - diff --git a/web/satellite/package-lock.json b/web/satellite/package-lock.json index 0f61f4566..33bd00eae 100644 --- a/web/satellite/package-lock.json +++ b/web/satellite/package-lock.json @@ -1757,12 +1757,6 @@ "@types/node": "*" } }, - "@types/segment-analytics": { - "version": "0.0.32", - "resolved": "https://registry.npmjs.org/@types/segment-analytics/-/segment-analytics-0.0.32.tgz", - "integrity": "sha512-p0SHnfHfZwemTeaISvu8WUXtw81A4AOU4GEr7B9S9jLx2iu/z/4aLT0flRJtHVusVAlMeJSdobn0uD/oR1sFEw==", - "dev": true - }, "@types/serve-static": { "version": "1.13.5", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.5.tgz", diff --git a/web/satellite/package.json b/web/satellite/package.json index 1135dbad9..d5c8f7ac8 100644 --- a/web/satellite/package.json +++ b/web/satellite/package.json @@ -37,7 +37,6 @@ "@babel/plugin-proposal-object-rest-spread": "7.11.0", "@types/node": "13.11.1", "@types/pbkdf2": "3.1.0", - "@types/segment-analytics": "0.0.32", "@types/vue2-datepicker": "3.3.0", "@vue/cli-plugin-babel": "4.5.6", "@vue/cli-plugin-typescript": "4.5.6", diff --git a/web/satellite/src/App.vue b/web/satellite/src/App.vue index edbfeb64e..cb022c695 100644 --- a/web/satellite/src/App.vue +++ b/web/satellite/src/App.vue @@ -30,7 +30,6 @@ export default class App extends Vue { public mounted(): void { const satelliteName = MetaUtils.getMetaContent('satellite-name'); const isBetaSatellite = MetaUtils.getMetaContent('is-beta-satellite'); - const segmentioId = MetaUtils.getMetaContent('segment-io'); const couponCodeUIEnabled = MetaUtils.getMetaContent('coupon-code-ui-enabled'); if (satelliteName) { @@ -45,9 +44,6 @@ export default class App extends Vue { this.$store.dispatch(APP_STATE_ACTIONS.SET_COUPON_CODE_UI_STATUS, couponCodeUIEnabled === 'true'); } - if (segmentioId) { - this.$segment.init(segmentioId); - } } } diff --git a/web/satellite/src/components/accessGrants/steps/NameStep.vue b/web/satellite/src/components/accessGrants/steps/NameStep.vue index daa0057f6..51b5498fa 100644 --- a/web/satellite/src/components/accessGrants/steps/NameStep.vue +++ b/web/satellite/src/components/accessGrants/steps/NameStep.vue @@ -48,7 +48,6 @@ import { PROJECTS_ACTIONS } from '@/store/modules/projects'; import { AccessGrant } from '@/types/accessGrants'; import { ProjectFields } from '@/types/projects'; import { PM_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; @Component({ components: { @@ -112,10 +111,6 @@ export default class NameStep extends Vue { ); const createdProject = await this.$store.dispatch(PROJECTS_ACTIONS.CREATE, project); - this.$segment.track(SegmentEvent.PROJECT_CREATED, { - project_id: createdProject.id, - }); - await this.$store.dispatch(PROJECTS_ACTIONS.SELECT, createdProject.id); await this.$store.dispatch(PM_ACTIONS.CLEAR); await this.$store.dispatch(PM_ACTIONS.FETCH, FIRST_PAGE); diff --git a/web/satellite/src/components/account/DeleteAccountPopup.vue b/web/satellite/src/components/account/DeleteAccountPopup.vue index 85a614ef1..a475dc407 100644 --- a/web/satellite/src/components/account/DeleteAccountPopup.vue +++ b/web/satellite/src/components/account/DeleteAccountPopup.vue @@ -54,7 +54,6 @@ import CloseCrossIcon from '@/../static/images/common/closeCross.svg'; import { AuthHttpApi } from '@/api/auth'; import { RouteConfig } from '@/router'; import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { Validator } from '@/utils/validation'; @Component({ @@ -98,10 +97,6 @@ export default class DeleteAccountPopup extends Vue { await this.auth.delete(this.password); await this.$notify.success('Account was successfully deleted'); - this.$segment.track(SegmentEvent.USER_DELETED, { - email: this.$store.getters.user.email, - }); - this.isLoading = false; await this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_DEL_ACCOUNT); await this.$router.push(RouteConfig.Login.path); diff --git a/web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue b/web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue index cf46af3fe..43e078582 100644 --- a/web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue +++ b/web/satellite/src/components/account/billing/depositAndBillingHistory/PeriodSelection.vue @@ -39,7 +39,6 @@ import HideIcon from '@/../static/images/common/BlueHide.svg'; import { RouteConfig } from '@/router'; import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; @Component({ components: { @@ -149,11 +148,6 @@ export default class PeriodSelection extends Vue { public async onPreviousPeriodClick(): Promise { try { await this.$store.dispatch(PAYMENTS_ACTIONS.GET_PROJECT_USAGE_AND_CHARGES_PREVIOUS_ROLLUP); - this.$segment.track(SegmentEvent.REPORT_VIEWED, { - project_id: this.$store.getters.selectedProject.id, - start_date: this.startDate, - end_date: this.endDate, - }); } catch (error) { await this.$notify.error(`Unable to fetch project charges. ${error.message}`); } @@ -165,11 +159,6 @@ export default class PeriodSelection extends Vue { public async onCurrentPeriodClick(): Promise { try { await this.$store.dispatch(PAYMENTS_ACTIONS.GET_PROJECT_USAGE_AND_CHARGES_CURRENT_ROLLUP); - this.$segment.track(SegmentEvent.REPORT_VIEWED, { - project_id: this.$store.getters.selectedProject.id, - start_date: this.startDate, - end_date: this.endDate, - }); } catch (error) { await this.$notify.error(`Unable to fetch project charges. ${error.message}`); } @@ -253,4 +242,4 @@ export default class PeriodSelection extends Vue { .selected-image { margin-right: 10px; } - \ No newline at end of file + diff --git a/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue b/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue index 26b5c17a9..6bdbb3a7e 100644 --- a/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue +++ b/web/satellite/src/components/account/billing/estimatedCostsAndCredits/UsageAndChargesItem.vue @@ -60,7 +60,6 @@ import ChargesHideIcon from '@/../static/images/account/billing/chargesHide.svg' import { ProjectUsageAndCharges } from '@/types/payments'; import { Project } from '@/types/projects'; import { Size } from '@/utils/bytesSize'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { SHORT_MONTHS_NAMES } from '@/utils/constants/date'; import { Time } from '@/utils/time'; @@ -152,12 +151,6 @@ export default class UsageAndChargesItem extends Vue { url.searchParams.append('since', Time.toUnixTimestamp(startDate).toString()); url.searchParams.append('before', Time.toUnixTimestamp(endDate).toString()); - this.$segment.track(SegmentEvent.REPORT_DOWNLOADED, { - start_date: startDate, - end_date: endDate, - project_id: projectID, - }); - window.open(url.href, '_blank'); } diff --git a/web/satellite/src/components/account/billing/paymentMethods/AddCardForm.vue b/web/satellite/src/components/account/billing/paymentMethods/AddCardForm.vue index 19a33e625..c16a10745 100644 --- a/web/satellite/src/components/account/billing/paymentMethods/AddCardForm.vue +++ b/web/satellite/src/components/account/billing/paymentMethods/AddCardForm.vue @@ -21,7 +21,6 @@ import StripeCardInput from '@/components/account/billing/paymentMethods/StripeC import { RouteConfig } from '@/router'; import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; const { ADD_CREDIT_CARD, @@ -62,9 +61,6 @@ export default class AddCardForm extends Vue { } await this.$notify.success('Card successfully added'); - this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, { - project_id: this.$store.getters.selectedProject.id, - }); try { await this.$store.dispatch(GET_CREDIT_CARDS); } catch (error) { @@ -93,10 +89,6 @@ export default class AddCardForm extends Vue { */ public async onConfirmAddStripe(): Promise { await this.$refs.stripeCardInput.onSubmit(); - - this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, { - project_id: this.$store.getters.selectedProject.id, - }); } /** diff --git a/web/satellite/src/components/account/billing/paymentMethods/AddStorjForm.vue b/web/satellite/src/components/account/billing/paymentMethods/AddStorjForm.vue index ffa896c3f..e83b550c1 100644 --- a/web/satellite/src/components/account/billing/paymentMethods/AddStorjForm.vue +++ b/web/satellite/src/components/account/billing/paymentMethods/AddStorjForm.vue @@ -36,7 +36,6 @@ import TokenDepositSelection from '@/components/account/billing/paymentMethods/T import VButton from '@/components/common/VButton.vue'; import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; const { MAKE_TOKEN_DEPOSIT, @@ -78,10 +77,6 @@ export default class AddStorjForm extends Vue { this.$emit('toggleIsLoading'); } - this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, { - project_id: this.$store.getters.selectedProject.id, - }); - this.tokenDepositValue = this.DEFAULT_TOKEN_DEPOSIT_VALUE; try { await this.$store.dispatch(GET_PAYMENTS_HISTORY); diff --git a/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue b/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue index e32d57f75..63da17579 100644 --- a/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue +++ b/web/satellite/src/components/account/billing/paymentMethods/PaymentMethods.vue @@ -96,7 +96,6 @@ import SuccessImage from '@/../static/images/account/billing/success.svg'; import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; import { CreditCard } from '@/types/payments'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { PaymentMethodsBlockState } from '@/utils/constants/billingEnums'; const { @@ -132,9 +131,6 @@ export default class PaymentMethods extends Vue { */ public mounted() { try { - this.$segment.track(SegmentEvent.PAYMENT_METHODS_VIEWED, { - project_id: this.$store.getters.selectedProject.id, - }); this.$store.dispatch(GET_CREDIT_CARDS); } catch (error) { this.$notify.error(error.message); diff --git a/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue b/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue index aa073addb..55d95fe3c 100644 --- a/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue +++ b/web/satellite/src/components/onboardingTour/steps/OverviewStep.vue @@ -18,7 +18,6 @@ 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 { SegmentEvent } from '@/utils/constants/analyticsEventNames'; @Component({ components: { @@ -102,10 +101,6 @@ export default class OverviewStep extends Vue { const createdProject = await this.$store.dispatch(PROJECTS_ACTIONS.CREATE, project); const createdProjectId = createdProject.id; - this.$segment.track(SegmentEvent.PROJECT_CREATED, { - project_id: createdProjectId, - }); - await this.$store.dispatch(PROJECTS_ACTIONS.SELECT, createdProjectId); await this.$store.dispatch(PM_ACTIONS.CLEAR); await this.$store.dispatch(PM_ACTIONS.FETCH, FIRST_PAGE); diff --git a/web/satellite/src/components/onboardingTour/steps/paymentStates/AddCardState.vue b/web/satellite/src/components/onboardingTour/steps/paymentStates/AddCardState.vue index 7c5216ce7..241f5c9f8 100644 --- a/web/satellite/src/components/onboardingTour/steps/paymentStates/AddCardState.vue +++ b/web/satellite/src/components/onboardingTour/steps/paymentStates/AddCardState.vue @@ -41,7 +41,6 @@ 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 { SegmentEvent } from '@/utils/constants/analyticsEventNames'; const { ADD_CREDIT_CARD, @@ -94,13 +93,6 @@ export default class AddCardState extends Vue { const createdProject = await this.$store.dispatch(PROJECTS_ACTIONS.CREATE, project); const createdProjectId = createdProject.id; - this.$segment.track(SegmentEvent.PROJECT_CREATED, { - project_id: createdProjectId, - }); - this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, { - project_id: createdProjectId, - }); - await this.$store.dispatch(PROJECTS_ACTIONS.SELECT, createdProjectId); await this.$store.dispatch(PM_ACTIONS.CLEAR); await this.$store.dispatch(PM_ACTIONS.FETCH, FIRST_PAGE); @@ -211,4 +203,4 @@ export default class AddCardState extends Vue { opacity: 0.6; pointer-events: none; } - \ No newline at end of file + diff --git a/web/satellite/src/components/onboardingTour/steps/paymentStates/AddStorjState.vue b/web/satellite/src/components/onboardingTour/steps/paymentStates/AddStorjState.vue index 0856dfae0..3089b3353 100644 --- a/web/satellite/src/components/onboardingTour/steps/paymentStates/AddStorjState.vue +++ b/web/satellite/src/components/onboardingTour/steps/paymentStates/AddStorjState.vue @@ -59,7 +59,6 @@ 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 { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { AddingStorjState } from '@/utils/constants/onboardingTourEnums'; @Component({ @@ -117,10 +116,6 @@ export default class AddStorjState extends Vue { const createdProject = await this.$store.dispatch(PROJECTS_ACTIONS.CREATE, project); const createdProjectId = createdProject.id; - this.$segment.track(SegmentEvent.PROJECT_CREATED, { - project_id: createdProjectId, - }); - await this.$store.dispatch(PROJECTS_ACTIONS.SELECT, createdProjectId); await this.$store.dispatch(PM_ACTIONS.CLEAR); await this.$store.dispatch(PM_ACTIONS.FETCH, FIRST_PAGE); @@ -273,4 +268,4 @@ export default class AddStorjState extends Vue { margin: 35px 0; } } - \ No newline at end of file + diff --git a/web/satellite/src/components/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.vue b/web/satellite/src/components/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.vue index d1c95340c..53b8a7d9e 100644 --- a/web/satellite/src/components/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.vue +++ b/web/satellite/src/components/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.vue @@ -36,7 +36,6 @@ import TokenDepositSelection from '@/components/account/billing/paymentMethods/T import VButton from '@/components/common/VButton.vue'; import { PAYMENTS_ACTIONS } from '@/store/modules/payments'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; const { MAKE_TOKEN_DEPOSIT, @@ -94,10 +93,6 @@ export default class PayingStep extends Vue { this.setDefaultState(); } - this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, { - project_id: this.$store.getters.selectedProject.id, - }); - this.tokenDepositValue = this.DEFAULT_TOKEN_DEPOSIT_VALUE; try { await this.$store.dispatch(GET_PAYMENTS_HISTORY); @@ -165,4 +160,4 @@ export default class PayingStep extends Vue { height: 18px; margin-left: 10px; } - \ No newline at end of file + diff --git a/web/satellite/src/components/project/CreateProject.vue b/web/satellite/src/components/project/CreateProject.vue index 329cdca29..b16b1dc2b 100644 --- a/web/satellite/src/components/project/CreateProject.vue +++ b/web/satellite/src/components/project/CreateProject.vue @@ -74,7 +74,6 @@ import { APP_STATE_ACTIONS, PM_ACTIONS, } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { LocalData } from '@/utils/localData'; @Component({ @@ -144,9 +143,6 @@ export default class NewProjectPopup extends Vue { try { const createdProject = await this.$store.dispatch(PROJECTS_ACTIONS.CREATE, project); this.createdProjectId = createdProject.id; - this.$segment.track(SegmentEvent.PROJECT_CREATED, { - project_id: this.createdProjectId, - }); } catch (error) { this.isLoading = false; await this.$notify.error(error.message); diff --git a/web/satellite/src/components/project/DeleteProjectPopup.vue b/web/satellite/src/components/project/DeleteProjectPopup.vue index 3bf83d987..385a00683 100644 --- a/web/satellite/src/components/project/DeleteProjectPopup.vue +++ b/web/satellite/src/components/project/DeleteProjectPopup.vue @@ -65,7 +65,6 @@ import { APP_STATE_ACTIONS, PM_ACTIONS, } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; @Component({ components: { @@ -100,11 +99,7 @@ export default class DeleteProjectPopup extends Vue { try { await this.$store.dispatch(PROJECTS_ACTIONS.DELETE, this.$store.getters.selectedProject.id); - this.$segment.track(SegmentEvent.PROJECT_DELETED, { - project_id: this.$store.getters.selectedProject.id, - }); await this.$notify.success('Project was successfully deleted'); - await this.selectProject(); } catch (e) { await this.$notify.error(e.message); diff --git a/web/satellite/src/components/project/ProjectDashboard.vue b/web/satellite/src/components/project/ProjectDashboard.vue index ce81eb7d1..68edde587 100644 --- a/web/satellite/src/components/project/ProjectDashboard.vue +++ b/web/satellite/src/components/project/ProjectDashboard.vue @@ -29,7 +29,6 @@ import InfoIcon from '@/../static/images/common/infoTooltipSm.svg'; import { RouteConfig } from '@/router'; import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { MetaUtils } from '@/utils/meta'; @Component({ @@ -44,7 +43,6 @@ import { MetaUtils } from '@/utils/meta'; export default class ProjectDashboard extends Vue { /** * Lifecycle hook after initial render. - * Segment tracking is processed. */ public mounted(): void { if (!this.$store.getters.selectedProject.id) { @@ -57,10 +55,6 @@ export default class ProjectDashboard extends Vue { if (projectLimit && this.$store.getters.projectsCount < projectLimit) { this.$store.dispatch(APP_STATE_ACTIONS.SHOW_CREATE_PROJECT_BUTTON); } - - this.$segment.track(SegmentEvent.PROJECT_VIEWED, { - project_id: this.$store.getters.selectedProject.id, - }); } /** diff --git a/web/satellite/src/components/team/AddUserPopup.vue b/web/satellite/src/components/team/AddUserPopup.vue index 6fcba08b3..18ae2a3df 100644 --- a/web/satellite/src/components/team/AddUserPopup.vue +++ b/web/satellite/src/components/team/AddUserPopup.vue @@ -91,7 +91,6 @@ import DeleteFieldIcon from '@/../static/images/team/deleteField.svg'; import { RouteConfig } from '@/router'; import { EmailInput } from '@/types/EmailInput'; import { APP_STATE_ACTIONS, PM_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { Validator } from '@/utils/validation'; @Component({ @@ -184,11 +183,6 @@ export default class AddUserPopup extends Vue { return; } - this.$segment.track(SegmentEvent.TEAM_MEMBER_INVITED, { - project_id: this.$store.getters.selectedProject.id, - invited_emails: emailArray, - }); - await this.$notify.success('Members successfully added to project!'); this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, ''); diff --git a/web/satellite/src/components/team/ProjectMembersArea.vue b/web/satellite/src/components/team/ProjectMembersArea.vue index 5c205fed3..eee0a889c 100644 --- a/web/satellite/src/components/team/ProjectMembersArea.vue +++ b/web/satellite/src/components/team/ProjectMembersArea.vue @@ -48,7 +48,6 @@ import EmptySearchResultIcon from '@/../static/images/common/emptySearchResult.s import { SortDirection } from '@/types/common'; import { ProjectMember, ProjectMemberHeaderState, ProjectMemberOrderBy } from '@/types/projectMembers'; import { PM_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; const { FETCH, @@ -86,10 +85,6 @@ export default class ProjectMembersArea extends Vue { */ public async mounted(): Promise { await this.$store.dispatch(FETCH, 1); - this.$segment.track(SegmentEvent.TEAM_VIEWED, { - project_id: this.$store.getters.selectedProject.id, - team_member_count: this.projectMembersTotalCount, - }); } /** diff --git a/web/satellite/src/main.ts b/web/satellite/src/main.ts index 002b9156a..e03871b94 100644 --- a/web/satellite/src/main.ts +++ b/web/satellite/src/main.ts @@ -6,7 +6,6 @@ import VueClipboard from 'vue-clipboard2'; import { DirectiveBinding } from 'vue/types/options'; import { NotificatorPlugin } from '@/utils/plugins/notificator'; -import { SegmentioPlugin } from '@/utils/plugins/segment'; import App from './App.vue'; import { router } from './router'; @@ -17,10 +16,8 @@ Vue.config.performance = true; Vue.config.productionTip = false; const notificator = new NotificatorPlugin(); -const segment = new SegmentioPlugin(); Vue.use(notificator); -Vue.use(segment); Vue.use(VueClipboard); let clickOutsideEvent: EventListener; diff --git a/web/satellite/src/types/plugins.ts b/web/satellite/src/types/plugins.ts index 36baca6c1..0e840afec 100644 --- a/web/satellite/src/types/plugins.ts +++ b/web/satellite/src/types/plugins.ts @@ -4,11 +4,9 @@ import Vue from 'vue'; import { Notificator } from '@/utils/plugins/notificator'; -import { Segmentio } from '@/utils/plugins/segment'; declare module 'vue/types/vue' { interface Vue { - $segment: Segmentio; // define real typings here if you want $notify: Notificator; } } diff --git a/web/satellite/src/utils/constants/analyticsEventNames.ts b/web/satellite/src/utils/constants/analyticsEventNames.ts index 6dc342ae9..9d3dd61db 100644 --- a/web/satellite/src/utils/constants/analyticsEventNames.ts +++ b/web/satellite/src/utils/constants/analyticsEventNames.ts @@ -1,27 +1,6 @@ // Copyright (C) 2019 Storj Labs, Inc. // See LICENSE for copying information. -export enum SegmentEvent { - PROJECT_CREATED = 'Project Created', - PROJECT_DELETED = 'Project Deleted', - PROJECT_VIEWED = 'Project Viewed', - USER_DELETED = 'User Deleted', - USER_LOGGED_IN = 'User Logged In', - EMAIL_VERIFIED = 'Email Verified', - API_KEY_CREATED = 'API Key Created', - API_KEY_DELETED = 'API Key Deleted', - API_KEYS_VIEWED = 'API Key Viewed', - PAYMENT_METHODS_VIEWED = 'Payment Methods Viewed', - PAYMENT_METHOD_ADDED = 'Payment Method Added', - REPORT_DOWNLOADED = 'Report Downloaded', - REPORT_VIEWED = 'Report Viewed', - BILLING_HISTORY_VIEWED = 'Billing History Viewed', - TEAM_MEMBER_INVITED = 'Team Member Invited', - TEAM_VIEWED = 'Team Viewed', - CLI_DOCS_VIEWED = 'Uplink CLI Docs Viewed', - GENERATE_GATEWAY_CREDENTIALS_CLICKED = 'Generate Gateway Credentials Clicked', -} - // Make sure these event names match up with the client-side event names in satellite/analytics/service.go export enum AnalyticsEvent { GATEWAY_CREDENTIALS_CREATED = 'Credentials Created', diff --git a/web/satellite/src/utils/plugins/segment.ts b/web/satellite/src/utils/plugins/segment.ts deleted file mode 100644 index a1ba6e98d..000000000 --- a/web/satellite/src/utils/plugins/segment.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2019 Storj Labs, Inc. -// See LICENSE for copying information. - -import loadScript from 'load-script'; - -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; - -/** - * Segmentio is a wrapper around segment.io analytics package. - */ -export class Segmentio { - private analytics: SegmentAnalytics.AnalyticsJS; - public init(key: string) { - if (this.analytics || key.length === 0 || key.includes('SegmentIOPublicKey')) { - return; - } - const source = `https://cdn.segment.com/analytics.js/v1/${key}/analytics.min.js`; - loadScript(source, (error) => { - if (error) { - return; - } - - this.analytics = window['analytics']; - }); - - this.page(); - } - - public page() { - if (!this.analytics) { - return; - } - - this.analytics.page(); - } - - public identify(userId: string, traits?: Object, options?: SegmentAnalytics.SegmentOpts, callback?: () => void) { - if (!this.analytics) { - return; - } - - this.analytics.identify(userId, traits, options, callback); - } - - public track(event: SegmentEvent, properties?: Object, options?: SegmentAnalytics.SegmentOpts, callback?: () => void) { - if (!this.analytics) { - return; - } - - this.analytics.track(event, properties, options, callback); - } -} - -export class SegmentioPlugin { - public install(Vue) { - Vue.prototype.$segment = new Segmentio(); - } -} diff --git a/web/satellite/src/views/login/LoginArea.vue b/web/satellite/src/views/login/LoginArea.vue index 0f1e12c9b..cb1ebf25d 100644 --- a/web/satellite/src/views/login/LoginArea.vue +++ b/web/satellite/src/views/login/LoginArea.vue @@ -14,7 +14,6 @@ import LogoIcon from '@/../static/images/Logo.svg'; import { AuthHttpApi } from '@/api/auth'; import { RouteConfig } from '@/router'; import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; -import { SegmentEvent } from '@/utils/constants/analyticsEventNames'; import { AppState } from '@/utils/constants/appStateEnum'; import { Validator } from '@/utils/validation'; @@ -114,9 +113,6 @@ export default class Login extends Vue { try { this.authToken = await this.auth.token(this.email, this.password); - this.$segment.track(SegmentEvent.USER_LOGGED_IN, { - email: this.email, - }); } catch (error) { await this.$notify.error(error.message); this.isLoading = false; diff --git a/web/satellite/src/views/register/RegisterArea.vue b/web/satellite/src/views/register/RegisterArea.vue index ecb881703..a4dd92240 100644 --- a/web/satellite/src/views/register/RegisterArea.vue +++ b/web/satellite/src/views/register/RegisterArea.vue @@ -336,19 +336,6 @@ export default class RegisterArea extends Vue { this.userId = await this.auth.register(this.user, this.secret); LocalData.setUserId(this.userId); - if (this.user.isProfessional) { - this.$segment.identify(this.userId, { - email: this.$store.getters.user.email, - position: this.$store.getters.user.position, - company_name: this.$store.getters.user.companyName, - employee_count: this.$store.getters.user.employeeCount, - }); - } else { - this.$segment.identify(this.userId, { - email: this.$store.getters.user.email, - }); - } - const verificationPageURL: string = MetaUtils.getMetaContent('verification-page-url'); if (verificationPageURL) { const externalAddress: string = MetaUtils.getMetaContent('external-address'); diff --git a/web/satellite/tests/unit/account/billing/paymentMethods/AddStorjForm.spec.ts b/web/satellite/tests/unit/account/billing/paymentMethods/AddStorjForm.spec.ts index 4a87fb08d..018aaaef4 100644 --- a/web/satellite/tests/unit/account/billing/paymentMethods/AddStorjForm.spec.ts +++ b/web/satellite/tests/unit/account/billing/paymentMethods/AddStorjForm.spec.ts @@ -15,7 +15,6 @@ import { PaymentsHistoryItem, PaymentsHistoryItemStatus, PaymentsHistoryItemType import { Project } from '@/types/projects'; import { User } from '@/types/users'; import { Notificator } from '@/utils/plugins/notificator'; -import { SegmentioPlugin } from '@/utils/plugins/segment'; import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; import { PaymentsMock } from '../../../mock/api/payments'; @@ -23,10 +22,8 @@ import { ProjectsApiMock } from '../../../mock/api/projects'; import { UsersApiMock } from '../../../mock/api/users'; const localVue = createLocalVue(); -const segmentioPlugin = new SegmentioPlugin(); localVue.use(Vuex); -localVue.use(segmentioPlugin); const paymentsApi = new PaymentsMock(); const paymentsModule = makePaymentsModule(paymentsApi); diff --git a/web/satellite/tests/unit/account/billing/paymentMethods/PaymentMethods.spec.ts b/web/satellite/tests/unit/account/billing/paymentMethods/PaymentMethods.spec.ts index 729b62481..4e069d034 100644 --- a/web/satellite/tests/unit/account/billing/paymentMethods/PaymentMethods.spec.ts +++ b/web/satellite/tests/unit/account/billing/paymentMethods/PaymentMethods.spec.ts @@ -13,7 +13,6 @@ import { makeUsersModule, USER_MUTATIONS } from '@/store/modules/users'; import { CreditCard } from '@/types/payments'; import { User } from '@/types/users'; import { Notificator } from '@/utils/plugins/notificator'; -import { SegmentioPlugin } from '@/utils/plugins/segment'; import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; import { PaymentsMock } from '../../../mock/api/payments'; @@ -21,10 +20,8 @@ import { ProjectsApiMock } from '../../../mock/api/projects'; import { UsersApiMock } from '../../../mock/api/users'; const localVue = createLocalVue(); -const segmentioPlugin = new SegmentioPlugin(); localVue.use(Vuex); -localVue.use(segmentioPlugin); const paymentsApi = new PaymentsMock(); const paymentsModule = makePaymentsModule(paymentsApi); diff --git a/web/satellite/tests/unit/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.spec.ts b/web/satellite/tests/unit/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.spec.ts index c2cd55b39..a23bd6646 100644 --- a/web/satellite/tests/unit/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.spec.ts +++ b/web/satellite/tests/unit/onboardingTour/steps/paymentStates/tokenSubSteps/PayingStep.spec.ts @@ -11,16 +11,13 @@ import { makePaymentsModule } from '@/store/modules/payments'; import { makeProjectsModule, PROJECTS_MUTATIONS } from '@/store/modules/projects'; import { Project } from '@/types/projects'; import { Notificator } from '@/utils/plugins/notificator'; -import { SegmentioPlugin } from '@/utils/plugins/segment'; import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; import { PaymentsMock } from '../../../../mock/api/payments'; import { ProjectsApiMock } from '../../../../mock/api/projects'; const localVue = createLocalVue(); -const segmentioPlugin = new SegmentioPlugin(); localVue.use(Vuex); -localVue.use(segmentioPlugin); const paymentsApi = new PaymentsMock(); const paymentsModule = makePaymentsModule(paymentsApi); diff --git a/web/satellite/tests/unit/project/ProjectDashboard.spec.ts b/web/satellite/tests/unit/project/ProjectDashboard.spec.ts index 720ca192c..8407130bc 100644 --- a/web/satellite/tests/unit/project/ProjectDashboard.spec.ts +++ b/web/satellite/tests/unit/project/ProjectDashboard.spec.ts @@ -9,16 +9,13 @@ import { appStateModule } from '@/store/modules/appState'; import { makeProjectsModule, PROJECTS_MUTATIONS } from '@/store/modules/projects'; import { makeUsersModule } from '@/store/modules/users'; import { Project } from '@/types/projects'; -import { SegmentioPlugin } from '@/utils/plugins/segment'; import { createLocalVue, shallowMount } from '@vue/test-utils'; import { ProjectsApiMock } from '../mock/api/projects'; import { UsersApiMock } from '../mock/api/users'; -const segmentioPlugin = new SegmentioPlugin(); const localVue = createLocalVue(); localVue.use(Vuex); -localVue.use(segmentioPlugin); const usersApi = new UsersApiMock(); const usersModule = makeUsersModule(usersApi); diff --git a/web/satellite/tests/unit/projectMembers/ProjectMembersArea.spec.ts b/web/satellite/tests/unit/projectMembers/ProjectMembersArea.spec.ts index 17f71e31a..dd9c8178b 100644 --- a/web/satellite/tests/unit/projectMembers/ProjectMembersArea.spec.ts +++ b/web/satellite/tests/unit/projectMembers/ProjectMembersArea.spec.ts @@ -10,16 +10,13 @@ import { makeProjectMembersModule, PROJECT_MEMBER_MUTATIONS } from '@/store/modu import { makeProjectsModule } from '@/store/modules/projects'; import { ProjectMember, ProjectMembersPage } from '@/types/projectMembers'; import { Project } from '@/types/projects'; -import { SegmentioPlugin } from '@/utils/plugins/segment'; import { createLocalVue, shallowMount } from '@vue/test-utils'; import { ProjectMembersApiMock } from '../mock/api/projectMembers'; import { ProjectsApiMock } from '../mock/api/projects'; const localVue = createLocalVue(); -const segmentioPlugin = new SegmentioPlugin(); localVue.use(Vuex); -localVue.use(segmentioPlugin); const pmApi = new ProjectMembersApiMock(); const projectMembersModule = makeProjectMembersModule(pmApi); diff --git a/web/satellite/tests/unit/views/DashboardArea.spec.ts b/web/satellite/tests/unit/views/DashboardArea.spec.ts index 388b13d6e..336eb6a05 100644 --- a/web/satellite/tests/unit/views/DashboardArea.spec.ts +++ b/web/satellite/tests/unit/views/DashboardArea.spec.ts @@ -16,7 +16,6 @@ import { User } from '@/types/users'; import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames'; import { AppState } from '@/utils/constants/appStateEnum'; import { NotificatorPlugin } from '@/utils/plugins/notificator'; -import { SegmentioPlugin } from '@/utils/plugins/segment'; import DashboardArea from '@/views/DashboardArea.vue'; import { createLocalVue, shallowMount } from '@vue/test-utils'; @@ -28,10 +27,8 @@ import { ProjectsApiMock } from '../mock/api/projects'; import { UsersApiMock } from '../mock/api/users'; const localVue = createLocalVue(); -const segmentioPlugin = new SegmentioPlugin(); const notificationPlugin = new NotificatorPlugin(); localVue.use(Vuex); -localVue.use(segmentioPlugin); localVue.use(notificationPlugin); const usersApi = new UsersApiMock(); diff --git a/web/satellite/tsconfig.json b/web/satellite/tsconfig.json index a5c8504bf..44fce888d 100644 --- a/web/satellite/tsconfig.json +++ b/web/satellite/tsconfig.json @@ -15,8 +15,7 @@ "strictPropertyInitialization": false, "types": [ "webpack-env", - "jest", - "segment-analytics" + "jest" ], "paths": { "@/*": [