satellite/analytics: Send signup captcha score to analytics
Send signup captcha score (if it exists) to Hubspot and Segment, so that we can implement logic based on this in the analytics platforms. Change-Id: Ic4e166639c9ab8e872a212e7466e82433c9ea6d4
This commit is contained in:
parent
e27381f3af
commit
b56a158100
@ -130,7 +130,7 @@ func (q *HubSpotEvents) EnqueueCreateUser(fields TrackCreateUserFields) {
|
||||
firstName = fullName
|
||||
}
|
||||
|
||||
newField := func(name, value string) map[string]interface{} {
|
||||
newField := func(name string, value interface{}) map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"name": name,
|
||||
"value": value,
|
||||
@ -148,6 +148,9 @@ func (q *HubSpotEvents) EnqueueCreateUser(fields TrackCreateUserFields) {
|
||||
newField("signup_partner", fields.UserAgent),
|
||||
newField("lifecyclestage", lifecycleStage),
|
||||
}
|
||||
if fields.SignupCaptcha != nil {
|
||||
formFields = append(formFields, newField("signup_captcha_score", *fields.SignupCaptcha))
|
||||
}
|
||||
|
||||
properties := map[string]interface{}{
|
||||
"userid": fields.ID.String(),
|
||||
|
@ -230,6 +230,7 @@ type TrackCreateUserFields struct {
|
||||
Referrer string
|
||||
HubspotUTK string
|
||||
UserAgent string
|
||||
SignupCaptcha *float64
|
||||
}
|
||||
|
||||
func (service *Service) enqueueMessage(message segment.Message) {
|
||||
@ -286,6 +287,9 @@ func (service *Service) TrackCreateUser(fields TrackCreateUserFields) {
|
||||
props.Set("origin_header", fields.OriginHeader)
|
||||
props.Set("signup_referrer", fields.Referrer)
|
||||
props.Set("account_created", true)
|
||||
if fields.SignupCaptcha != nil {
|
||||
props.Set("signup_captcha", &fields.SignupCaptcha)
|
||||
}
|
||||
|
||||
if fields.Type == Professional {
|
||||
props.Set("company_size", fields.EmployeeCount)
|
||||
|
@ -352,15 +352,16 @@ func (a *Auth) Register(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
trackCreateUserFields := analytics.TrackCreateUserFields{
|
||||
ID: user.ID,
|
||||
AnonymousID: loadSession(r),
|
||||
FullName: user.FullName,
|
||||
Email: user.Email,
|
||||
Type: analytics.Personal,
|
||||
OriginHeader: r.Header.Get("Origin"),
|
||||
Referrer: referrer,
|
||||
HubspotUTK: hubspotUTK,
|
||||
UserAgent: string(user.UserAgent),
|
||||
ID: user.ID,
|
||||
AnonymousID: loadSession(r),
|
||||
FullName: user.FullName,
|
||||
Email: user.Email,
|
||||
Type: analytics.Personal,
|
||||
OriginHeader: r.Header.Get("Origin"),
|
||||
Referrer: referrer,
|
||||
HubspotUTK: hubspotUTK,
|
||||
UserAgent: string(user.UserAgent),
|
||||
SignupCaptcha: user.SignupCaptcha,
|
||||
}
|
||||
if user.IsProfessional {
|
||||
trackCreateUserFields.Type = analytics.Professional
|
||||
|
Loading…
Reference in New Issue
Block a user