satellite/analytics: Added tracks calls for product activity metrics (#4907)
satellite/analytics: Added tracks calls for product activity metrics
This commit is contained in:
parent
4e81a60838
commit
6a1d7c8747
@ -43,6 +43,12 @@ const (
|
||||
eventUploadInWebClicked = "Upload In Web Clicked"
|
||||
eventNewProjectClicked = "New Project Clicked"
|
||||
eventLogoutClicked = "Logout Clicked"
|
||||
eventProfileUpdated = "Profile Updated"
|
||||
eventPasswordChanged = "Password Changed"
|
||||
eventMfaEnabled = "MFA Enabled"
|
||||
eventBucketCreated = "Bucket Created"
|
||||
eventBucketDeleted = "Bucket Deleted"
|
||||
eventProjectLimitError = "Project Limit Error"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -86,7 +92,8 @@ func NewService(log *zap.Logger, config Config, satelliteName string) *Service {
|
||||
eventPathSelected, eventLinkShared, eventObjectUploaded, eventAPIKeyGenerated, eventUpgradeBannerClicked,
|
||||
eventModalAddCard, eventModalAddTokens, eventSearchBuckets, eventNavigateProjects, eventManageProjectsClicked,
|
||||
eventCreateNewClicked, eventViewDocsClicked, eventViewForumClicked, eventViewSupportClicked, eventCreateAnAccessGrantClicked,
|
||||
eventUploadUsingCliClicked, eventUploadInWebClicked, eventNewProjectClicked, eventLogoutClicked} {
|
||||
eventUploadUsingCliClicked, eventUploadInWebClicked, eventNewProjectClicked, eventLogoutClicked, eventProfileUpdated,
|
||||
eventPasswordChanged, eventMfaEnabled, eventBucketCreated, eventBucketDeleted} {
|
||||
service.clientEvents[name] = true
|
||||
}
|
||||
|
||||
@ -395,3 +402,20 @@ func (service *Service) PageVisitEvent(pageName string, userID uuid.UUID, email
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// TrackProjectLimitError sends an "Project Limit Error" event to Segment.
|
||||
func (service *Service) TrackProjectLimitError(userID uuid.UUID, email string) {
|
||||
if !service.config.Enabled {
|
||||
return
|
||||
}
|
||||
|
||||
props := segment.NewProperties()
|
||||
props.Set("email", email)
|
||||
|
||||
service.enqueueMessage(segment.Track{
|
||||
UserId: userID.String(),
|
||||
Event: service.satelliteName + " " + eventProjectLimitError,
|
||||
Properties: props,
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -1364,6 +1364,7 @@ func (s *Service) CreateProject(ctx context.Context, projectInfo ProjectInfo) (p
|
||||
|
||||
currentProjectCount, err := s.checkProjectLimit(ctx, user.ID)
|
||||
if err != nil {
|
||||
s.analytics.TrackProjectLimitError(user.ID, user.Email)
|
||||
return nil, ErrProjLimit.Wrap(err)
|
||||
}
|
||||
|
||||
@ -1891,8 +1892,6 @@ func (s *Service) CreateAPIKey(ctx context.Context, projectID uuid.UUID, name st
|
||||
return nil, nil, Error.Wrap(err)
|
||||
}
|
||||
|
||||
s.analytics.TrackAccessGrantCreated(user.ID, user.Email)
|
||||
|
||||
return info, key, nil
|
||||
}
|
||||
|
||||
@ -1965,8 +1964,6 @@ func (s *Service) GenCreateAPIKey(ctx context.Context, requestInfo CreateAPIKeyR
|
||||
}
|
||||
}
|
||||
|
||||
s.analytics.TrackAccessGrantCreated(user.ID, user.Email)
|
||||
|
||||
return &CreateAPIKeyResponse{
|
||||
Key: key.Serialize(),
|
||||
KeyInfo: info,
|
||||
|
@ -78,6 +78,9 @@ import { AuthHttpApi } from '@/api/auth';
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { Validator } from '@/utils/validation';
|
||||
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
// @vue/component
|
||||
@Component({
|
||||
components: {
|
||||
@ -99,6 +102,8 @@ export default class ChangePasswordPopup extends Vue {
|
||||
|
||||
private readonly auth: AuthHttpApi = new AuthHttpApi();
|
||||
|
||||
private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
|
||||
/**
|
||||
* Indicates if hint popup needs to be shown while creating new password.
|
||||
*/
|
||||
@ -164,6 +169,7 @@ export default class ChangePasswordPopup extends Vue {
|
||||
return;
|
||||
}
|
||||
|
||||
this.analytics.eventTriggered(AnalyticsEvent.PASSWORD_CHANGED);
|
||||
await this.$notify.success('Password successfully changed!');
|
||||
this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_CHANGE_PASSWORD_POPUP);
|
||||
}
|
||||
|
@ -53,6 +53,9 @@ import { USER_ACTIONS } from '@/store/modules/users';
|
||||
import { UpdatedUser } from '@/types/users';
|
||||
import { APP_STATE_ACTIONS } from '@/utils/constants/actionNames';
|
||||
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
// @vue/component
|
||||
@Component({
|
||||
components: {
|
||||
@ -72,6 +75,8 @@ export default class EditProfilePopup extends Vue {
|
||||
this.fullNameError = '';
|
||||
}
|
||||
|
||||
private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
|
||||
/**
|
||||
* Validates name and tries to update user info and close popup.
|
||||
*/
|
||||
@ -90,6 +95,8 @@ export default class EditProfilePopup extends Vue {
|
||||
return;
|
||||
}
|
||||
|
||||
this.analytics.eventTriggered(AnalyticsEvent.PROFILE_UPDATED);
|
||||
|
||||
await this.$notify.success('Account info successfully updated!');
|
||||
|
||||
await this.$store.dispatch(APP_STATE_ACTIONS.TOGGLE_EDIT_PROFILE_POPUP);
|
||||
|
@ -88,6 +88,9 @@ import CloseCrossIcon from '@/../static/images/common/closeCross.svg';
|
||||
|
||||
import { USER_ACTIONS } from '@/store/modules/users';
|
||||
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
// @vue/component
|
||||
@Component({
|
||||
components: {
|
||||
@ -113,6 +116,8 @@ export default class EnableMFAPopup extends Vue {
|
||||
canvas: HTMLCanvasElement;
|
||||
};
|
||||
|
||||
private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
|
||||
/**
|
||||
* Mounted lifecycle hook after initial render.
|
||||
* Renders QR code.
|
||||
@ -159,6 +164,7 @@ export default class EnableMFAPopup extends Vue {
|
||||
await this.$store.dispatch(USER_ACTIONS.ENABLE_USER_MFA, this.confirmPasscode);
|
||||
await this.$store.dispatch(USER_ACTIONS.GET);
|
||||
await this.showCodes();
|
||||
this.analytics.eventTriggered(AnalyticsEvent.MFA_ENABLED);
|
||||
await this.$notify.success('MFA was enabled successfully');
|
||||
} catch (error) {
|
||||
await this.$notify.error(error.message);
|
||||
|
@ -32,6 +32,7 @@ import BucketCreationNameStep from "@/components/objects/BucketCreationNameStep.
|
||||
import BucketCreationProgress from "@/components/objects/BucketCreationProgress.vue";
|
||||
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
export enum BucketCreationSteps {
|
||||
Name = 0,
|
||||
@ -99,6 +100,7 @@ export default class BucketCreation extends Vue {
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.CREATE_BUCKET, this.bucketName);
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.FETCH_BUCKETS);
|
||||
await this.$store.dispatch(OBJECTS_ACTIONS.SET_FILE_COMPONENT_BUCKET_NAME, this.bucketName);
|
||||
this.analytics.eventTriggered(AnalyticsEvent.BUCKET_CREATED);
|
||||
this.analytics.pageVisit(RouteConfig.UploadFile.path);
|
||||
await this.$router.push(RouteConfig.UploadFile.path);
|
||||
} catch (e) {
|
||||
|
@ -81,6 +81,7 @@ import ObjectsPopup from '@/components/objects/ObjectsPopup.vue';
|
||||
import BucketIcon from '@/../static/images/objects/bucket.svg';
|
||||
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
// @vue/component
|
||||
@Component({
|
||||
@ -314,6 +315,8 @@ export default class BucketsView extends Vue {
|
||||
this.isRequestProcessing = false;
|
||||
}
|
||||
|
||||
this.analytics.eventTriggered(AnalyticsEvent.BUCKET_DELETED);
|
||||
|
||||
this.deleteBucketName = '';
|
||||
this.hideDeleteBucketPopup();
|
||||
}
|
||||
|
@ -25,4 +25,9 @@ export enum AnalyticsEvent {
|
||||
UPLOAD_IN_WEB_CLICKED = 'Upload In Web Clicked',
|
||||
NEW_PROJECT_CLICKED = 'New Project Clicked',
|
||||
LOGOUT_CLICKED = 'Logout Clicked',
|
||||
PROFILE_UPDATED = 'Profile Updated',
|
||||
PASSWORD_CHANGED = 'Password Changed',
|
||||
MFA_ENABLED = 'MFA Enabled',
|
||||
BUCKET_CREATED = 'Bucket Created',
|
||||
BUCKET_DELETED = 'Bucket Deleted',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user