satellite/analytics: Added analytics to track project members addition/deletion (#5340)
satellite/analytics: Added analytics to track project members addition/deletion
This commit is contained in:
parent
2442ba415f
commit
3fe6aee786
@ -71,6 +71,9 @@ const (
|
||||
eventCreditCardAddedFromBilling = "Credit Card Added From Billing"
|
||||
eventStorjTokenAddedFromBilling = "Storj Token Added From Billing"
|
||||
eventAddFundsClicked = "Add Funds Clicked"
|
||||
eventProjectMembersInviteSent = "Project Members Invite Sent"
|
||||
eventProjectMemberAdded = "Project Member Added"
|
||||
eventProjectMemberDeleted = "Project Member Deleted"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -120,7 +123,7 @@ func NewService(log *zap.Logger, config Config, satelliteName string) *Service {
|
||||
eventCopyToClipboardClicked, eventCreateAccessGrantClicked, eventCreateS3CredentialsClicked, eventKeysForCLIClicked,
|
||||
eventSeePaymentsClicked, eventEditPaymentMethodClicked, eventUsageDetailedInfoClicked, eventAddNewPaymentMethodClicked,
|
||||
eventApplyNewCouponClicked, eventCreditCardRemoved, eventCouponCodeApplied, eventInvoiceDownloaded, eventCreditCardAddedFromBilling,
|
||||
eventStorjTokenAddedFromBilling, eventAddFundsClicked} {
|
||||
eventStorjTokenAddedFromBilling, eventAddFundsClicked, eventProjectMembersInviteSent} {
|
||||
service.clientEvents[name] = true
|
||||
}
|
||||
|
||||
@ -469,3 +472,37 @@ func (service *Service) TrackStorjTokenAdded(userID uuid.UUID, email string) {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// TrackProjectMemberAddition sends an "Project Member Added" event to Segment.
|
||||
func (service *Service) TrackProjectMemberAddition(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 + " " + eventProjectMemberAdded,
|
||||
Properties: props,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// TrackProjectMemberDeletion sends an "Project Member Deleted" event to Segment.
|
||||
func (service *Service) TrackProjectMemberDeletion(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 + " " + eventProjectMemberDeleted,
|
||||
Properties: props,
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -1865,6 +1865,8 @@ func (s *Service) AddProjectMembers(ctx context.Context, projectID uuid.UUID, em
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
|
||||
s.analytics.TrackProjectMemberAddition(user.ID, user.Email)
|
||||
|
||||
return users, nil
|
||||
}
|
||||
|
||||
@ -1916,6 +1918,9 @@ func (s *Service) DeleteProjectMembers(ctx context.Context, projectID uuid.UUID,
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
s.analytics.TrackProjectMemberDeletion(user.ID, user.Email)
|
||||
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,8 @@ import { EmailInput } from '@/types/EmailInput';
|
||||
import { PM_ACTIONS } from '@/utils/constants/actionNames';
|
||||
import { Validator } from '@/utils/validation';
|
||||
import { APP_STATE_MUTATIONS } from '@/store/mutationConstants';
|
||||
import { AnalyticsHttpApi } from '@/api/analytics';
|
||||
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
|
||||
|
||||
import VButton from '@/components/common/VButton.vue';
|
||||
import VModal from '@/components/common/VModal.vue';
|
||||
@ -117,6 +119,8 @@ export default class AddTeamMemberModal extends Vue {
|
||||
|
||||
private FIRST_PAGE = 1;
|
||||
|
||||
private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
|
||||
|
||||
/**
|
||||
* Tries to add users related to entered emails list to current project.
|
||||
*/
|
||||
@ -188,6 +192,7 @@ export default class AddTeamMemberModal extends Vue {
|
||||
return;
|
||||
}
|
||||
|
||||
this.analytics.eventTriggered(AnalyticsEvent.PROJECT_MEMBERS_INVITE_SENT);
|
||||
await this.$notify.notify(`The user(s) you've invited to your project will receive your invitation if they have an account on this satellite.`);
|
||||
this.$store.dispatch(PM_ACTIONS.SET_SEARCH_QUERY, '');
|
||||
|
||||
|
@ -52,5 +52,6 @@ export enum AnalyticsEvent {
|
||||
CREDIT_CARD_ADDED_FROM_BILLING = 'Credit Card Added From Billing',
|
||||
STORJ_TOKEN_ADDED_FROM_BILLING = 'Storj Token Added From Billing',
|
||||
ADD_FUNDS_CLICKED = 'Add Funds Clicked',
|
||||
PROJECT_MEMBERS_INVITE_SENT = 'Project Members Invite Sent',
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user