satellite/analytics: Added "email" in segment track calls

Added "email" property in segment track calls so that we are able to send user behavioral events to HubSpot through segment.io
This commit is contained in:
prerna-parashar 2022-03-29 13:05:56 -07:00 committed by GitHub
parent 952f50e6e3
commit 9ef11644fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,6 +219,7 @@ func (service *Service) TrackProjectCreated(userID uuid.UUID, email string, proj
props := segment.NewProperties()
props.Set("project_count", currentProjectCount)
props.Set("project_id", projectID.String())
props.Set("email", email)
service.enqueueMessage(segment.Track{
UserId: userID.String(),
@ -239,9 +240,13 @@ func (service *Service) TrackAccessGrantCreated(userID uuid.UUID, email string)
return
}
props := segment.NewProperties()
props.Set("email", email)
service.enqueueMessage(segment.Track{
UserId: userID.String(),
Event: service.satelliteName + " " + eventAccessGrantCreated,
UserId: userID.String(),
Event: service.satelliteName + " " + eventAccessGrantCreated,
Properties: props,
})
service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventAccessGrantCreated, map[string]interface{}{
@ -289,9 +294,14 @@ func (service *Service) TrackEvent(eventName string, userID uuid.UUID, email str
service.log.Error("Invalid client-triggered event", zap.String("eventName", eventName))
return
}
props := segment.NewProperties()
props.Set("email", email)
service.enqueueMessage(segment.Track{
UserId: userID.String(),
Event: service.satelliteName + " " + eventName,
UserId: userID.String(),
Event: service.satelliteName + " " + eventName,
Properties: props,
})
service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventName, map[string]interface{}{
@ -314,6 +324,7 @@ func (service *Service) TrackLinkEvent(eventName string, userID uuid.UUID, email
props := segment.NewProperties()
props.Set("link", link)
props.Set("email", email)
service.enqueueMessage(segment.Track{
UserId: userID.String(),