From 25ffa3ad115eed0f2ae13ed76254d4199b29ccd0 Mon Sep 17 00:00:00 2001 From: Vitalii Date: Fri, 29 Sep 2023 15:43:14 +0300 Subject: [PATCH] satellite/analytics: stop sending normal account activity events directly to Hubspot Removed code which was responsible for tracking regular user activity in hubspot. The only direct event we send to Hubspot is 'user created'. Issue: https://github.com/storj/storj-private/issues/441 Change-Id: Ia6da30374f91369372af8fe5b5990ec5672fc03b --- satellite/analytics/hubspot.go | 21 --------------------- satellite/analytics/service.go | 33 --------------------------------- 2 files changed, 54 deletions(-) diff --git a/satellite/analytics/hubspot.go b/satellite/analytics/hubspot.go index 7b4d98e64..bcfbdb235 100644 --- a/satellite/analytics/hubspot.go +++ b/satellite/analytics/hubspot.go @@ -203,27 +203,6 @@ func (q *HubSpotEvents) EnqueueCreateUser(fields TrackCreateUserFields) { } } -// EnqueueEvent for sending user behavioral event to HubSpot. -func (q *HubSpotEvents) EnqueueEvent(email, eventName string, properties map[string]interface{}) { - eventName = strings.ReplaceAll(eventName, " ", "_") - eventName = strings.ToLower(eventName) - eventName = eventPrefix + "_" + eventName - - newEvent := HubSpotEvent{ - Endpoint: "https://api.hubapi.com/events/v3/send", - Data: map[string]interface{}{ - "email": email, - "eventName": eventName, - "properties": properties, - }, - } - select { - case q.events <- []HubSpotEvent{newEvent}: - default: - q.log.Error("sending hubspot event failed, event channel is full") - } -} - // handleSingleEvent for handle the single HubSpot API request. func (q *HubSpotEvents) handleSingleEvent(ctx context.Context, ev HubSpotEvent) (err error) { payloadBytes, err := json.Marshal(ev.Data) diff --git a/satellite/analytics/service.go b/satellite/analytics/service.go index 9f318e6a1..50d936194 100644 --- a/satellite/analytics/service.go +++ b/satellite/analytics/service.go @@ -321,10 +321,6 @@ func (service *Service) TrackSignedIn(userID uuid.UUID, email string) { Event: service.satelliteName + " " + eventSignedIn, Properties: props, }) - - service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventSignedIn, map[string]interface{}{ - "userid": userID.String(), - }) } // TrackProjectCreated sends an "Project Created" event to Segment. @@ -343,12 +339,6 @@ func (service *Service) TrackProjectCreated(userID uuid.UUID, email string, proj Event: service.satelliteName + " " + eventProjectCreated, Properties: props, }) - - service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventProjectCreated, map[string]interface{}{ - "userid": userID.String(), - "project_count": currentProjectCount, - "project_id": projectID.String(), - }) } // TrackAccountFrozen sends an account frozen event to Segment. @@ -484,10 +474,6 @@ func (service *Service) TrackAccessGrantCreated(userID uuid.UUID, email string) Event: service.satelliteName + " " + eventAccessGrantCreated, Properties: props, }) - - service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventAccessGrantCreated, map[string]interface{}{ - "userid": userID.String(), - }) } // TrackAccountVerified sends an "Account Verified" event to Segment. @@ -512,10 +498,6 @@ func (service *Service) TrackAccountVerified(userID uuid.UUID, email string) { Event: service.satelliteName + " " + eventAccountVerified, Properties: props, }) - - service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventAccountVerified, map[string]interface{}{ - "userid": userID.String(), - }) } // TrackEvent sends an arbitrary event associated with user ID to Segment. @@ -543,10 +525,6 @@ func (service *Service) TrackEvent(eventName string, userID uuid.UUID, email str Event: service.satelliteName + " " + eventName, Properties: props, }) - - service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventName, map[string]interface{}{ - "userid": userID.String(), - }) } // TrackErrorEvent sends an arbitrary error event associated with user ID to Segment. @@ -589,11 +567,6 @@ func (service *Service) TrackLinkEvent(eventName string, userID uuid.UUID, email Event: service.satelliteName + " " + eventName, Properties: props, }) - - service.hubspot.EnqueueEvent(email, service.satelliteName+"_"+eventName, map[string]interface{}{ - "userid": userID.String(), - "link": link, - }) } // TrackCreditCardAdded sends an "Credit Card Added" event to Segment. @@ -610,7 +583,6 @@ func (service *Service) TrackCreditCardAdded(userID uuid.UUID, email string) { Event: service.satelliteName + " " + eventCreditCardAdded, Properties: props, }) - } // PageVisitEvent sends a page visit event associated with user ID to Segment. @@ -631,7 +603,6 @@ func (service *Service) PageVisitEvent(pageName string, userID uuid.UUID, email Name: "Page Requested", Properties: props, }) - } // TrackProjectLimitError sends an "Project Limit Error" event to Segment. @@ -648,7 +619,6 @@ func (service *Service) TrackProjectLimitError(userID uuid.UUID, email string) { Event: service.satelliteName + " " + eventProjectLimitError, Properties: props, }) - } // TrackStorjTokenAdded sends an "Storj Token Added" event to Segment. @@ -665,7 +635,6 @@ func (service *Service) TrackStorjTokenAdded(userID uuid.UUID, email string) { Event: service.satelliteName + " " + eventStorjTokenAdded, Properties: props, }) - } // TrackProjectMemberAddition sends an "Project Member Added" event to Segment. @@ -682,7 +651,6 @@ func (service *Service) TrackProjectMemberAddition(userID uuid.UUID, email strin Event: service.satelliteName + " " + eventProjectMemberAdded, Properties: props, }) - } // TrackProjectMemberDeletion sends an "Project Member Deleted" event to Segment. @@ -699,7 +667,6 @@ func (service *Service) TrackProjectMemberDeletion(userID uuid.UUID, email strin Event: service.satelliteName + " " + eventProjectMemberDeleted, Properties: props, }) - } // TrackExpiredCreditNeedsRemoval sends an "Expired Credit Needs Removal" event to Segment.