satellite/analytics: Track event "Credit Card Added" (#4749)
satellite/analytics: Track event "Credit Card Added"
This commit is contained in:
parent
04b22f24eb
commit
894b7b1cf3
@ -27,6 +27,7 @@ const (
|
||||
eventLinkShared = "Link Shared"
|
||||
eventObjectUploaded = "Object Uploaded"
|
||||
eventAPIKeyGenerated = "API Key Generated"
|
||||
eventCreditCardAdded = "Credit Card Added"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -338,3 +339,20 @@ func (service *Service) TrackLinkEvent(eventName string, userID uuid.UUID, email
|
||||
"link": link,
|
||||
})
|
||||
}
|
||||
|
||||
// TrackCreditCardAdded sends an "Credit Card Added" event to Segment.
|
||||
func (service *Service) TrackCreditCardAdded(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 + " " + eventCreditCardAdded,
|
||||
Properties: props,
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -271,6 +271,8 @@ func (paymentService PaymentsService) AddCreditCard(ctx context.Context, creditC
|
||||
return Error.Wrap(err)
|
||||
}
|
||||
|
||||
paymentService.service.analytics.TrackCreditCardAdded(auth.User.ID, auth.User.Email)
|
||||
|
||||
if !auth.User.PaidTier {
|
||||
// put this user into the paid tier and convert projects to upgraded limits.
|
||||
err = paymentService.service.store.Users().UpdatePaidTier(ctx, auth.User.ID, true,
|
||||
|
Loading…
Reference in New Issue
Block a user