satellite/analytics: Track have_sales_contact differently
When signing up, a user can opt in to having sales contact them. This change alters the way this flag is passed to Hubspot and Segment. Hubspot sends a form submission request to create the user, followed by a "custom behavioral event" with some additional user info. Segment sends an "Identify" call followed by a "create user" event. This change moves "have_sales_contact" to the form submission for Hubspot, and the Identify call for Segment. This simplifies the process of applying this field to a contact/user in Segment and Hubspot. Change-Id: I5e6871b3926a76fb24f97fb2d835a26720275072
This commit is contained in:
parent
75544aa435
commit
c96ff2fdef
@ -9,6 +9,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -121,6 +122,7 @@ func (q *HubSpotEvents) EnqueueCreateUser(fields TrackCreateUserFields) {
|
||||
newField("origin_header", fields.OriginHeader),
|
||||
newField("signup_referrer", fields.Referrer),
|
||||
newField("account_created", "true"),
|
||||
newField("have_sales_contact", strconv.FormatBool(fields.HaveSalesContact)),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -139,7 +141,6 @@ func (q *HubSpotEvents) EnqueueCreateUser(fields TrackCreateUserFields) {
|
||||
"company_size": fields.EmployeeCount,
|
||||
"company_name": fields.CompanyName,
|
||||
"job_title": fields.JobTitle,
|
||||
"have_sales_contact": fields.HaveSalesContact,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -176,6 +176,9 @@ func (service *Service) TrackCreateUser(fields TrackCreateUserFields) {
|
||||
traits.Set("origin_header", fields.OriginHeader)
|
||||
traits.Set("signup_referrer", fields.Referrer)
|
||||
traits.Set("account_created", true)
|
||||
if fields.Type == Professional {
|
||||
traits.Set("have_sales_contact", fields.HaveSalesContact)
|
||||
}
|
||||
|
||||
service.enqueueMessage(segment.Identify{
|
||||
UserId: fields.ID.String(),
|
||||
@ -196,7 +199,6 @@ func (service *Service) TrackCreateUser(fields TrackCreateUserFields) {
|
||||
props.Set("company_size", fields.EmployeeCount)
|
||||
props.Set("company_name", fields.CompanyName)
|
||||
props.Set("job_title", fields.JobTitle)
|
||||
props.Set("have_sales_contact", fields.HaveSalesContact)
|
||||
}
|
||||
|
||||
service.enqueueMessage(segment.Track{
|
||||
|
Loading…
Reference in New Issue
Block a user