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
This commit is contained in:
parent
16c98e1ecd
commit
c4a950a40c
@ -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
|
||||
|
3
scripts/testdata/satellite-config.yaml.lock
vendored
3
scripts/testdata/satellite-config.yaml.lock
vendored
@ -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/"
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
<meta name="external-address" content="{{ .ExternalAddress }}">
|
||||
<meta name="satellite-name" content="{{ .SatelliteName }}">
|
||||
<meta name="satellite-nodeurl" content="{{ .SatelliteNodeURL }}">
|
||||
<meta name="segment-io" content="{{ .SegmentIOPublicKey }}">
|
||||
<meta name="stripe-public-key" content="{{ .StripePublicKey }}">
|
||||
<meta name="verification-page-url" content="{{ .VerificationPageURL }}">
|
||||
<meta name="partnered-satellite-names" content="{{ .PartneredSatelliteNames }}">
|
||||
|
6
web/satellite/package-lock.json
generated
6
web/satellite/package-lock.json
generated
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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<void> {
|
||||
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<void> {
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
@ -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<void> {
|
||||
await this.$refs.stripeCardInput.onSubmit();
|
||||
|
||||
this.$segment.track(SegmentEvent.PAYMENT_METHOD_ADDED, {
|
||||
project_id: this.$store.getters.selectedProject.id,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -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;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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, '');
|
||||
|
||||
|
@ -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<void> {
|
||||
await this.$store.dispatch(FETCH, 1);
|
||||
this.$segment.track(SegmentEvent.TEAM_VIEWED, {
|
||||
project_id: this.$store.getters.selectedProject.id,
|
||||
team_member_count: this.projectMembersTotalCount,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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',
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -15,8 +15,7 @@
|
||||
"strictPropertyInitialization": false,
|
||||
"types": [
|
||||
"webpack-env",
|
||||
"jest",
|
||||
"segment-analytics"
|
||||
"jest"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
|
Loading…
Reference in New Issue
Block a user