satellite/analytics: Add user agent to TrackCreateUser

Send UserAgent (as "signup_partner") to Segment and Hubspot.

Change-Id: I3313eb902e87b429e7fa8e18afd397a63a3ed07d
This commit is contained in:
Moby von Briesen 2022-07-29 17:27:24 -04:00
parent b4ea1bac42
commit 78fa0c11a3
3 changed files with 6 additions and 0 deletions

View File

@ -123,6 +123,7 @@ func (q *HubSpotEvents) EnqueueCreateUser(fields TrackCreateUserFields) {
newField("signup_referrer", fields.Referrer),
newField("account_created", "true"),
newField("have_sales_contact", strconv.FormatBool(fields.HaveSalesContact)),
newField("signup_partner", fields.UserAgent),
},
},
}

View File

@ -140,6 +140,7 @@ type TrackCreateUserFields struct {
OriginHeader string
Referrer string
HubspotUTK string
UserAgent string
}
func (service *Service) enqueueMessage(message segment.Message) {
@ -179,6 +180,9 @@ func (service *Service) TrackCreateUser(fields TrackCreateUserFields) {
if fields.Type == Professional {
traits.Set("have_sales_contact", fields.HaveSalesContact)
}
if len(fields.UserAgent) > 0 {
traits.Set("signup_partner", fields.UserAgent)
}
service.enqueueMessage(segment.Identify{
UserId: fields.ID.String(),

View File

@ -303,6 +303,7 @@ func (a *Auth) Register(w http.ResponseWriter, r *http.Request) {
OriginHeader: origin,
Referrer: referrer,
HubspotUTK: hubspotUTK,
UserAgent: string(user.UserAgent),
}
if user.IsProfessional {
trackCreateUserFields.Type = analytics.Professional