Heatmaps fix (float coordinates) (#2403)
* feat(spot): use float click coordinates instead of ints in PG * feat(db): added support for float clicks in CH * feat(db): fix float instead of uint8 * feat(mobile): new naming for mobile autocomplete types
This commit is contained in:
parent
bac0360735
commit
b3d04d76d4
4 changed files with 28 additions and 14 deletions
|
|
@ -81,13 +81,13 @@ func (s *saverImpl) handleMobileMessage(msg Message) error {
|
|||
if err = s.sessions.UpdateUserID(session.SessionID, m.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
s.pg.InsertAutocompleteValue(session.SessionID, session.ProjectID, "USERID_Mobile", m.ID)
|
||||
s.pg.InsertAutocompleteValue(session.SessionID, session.ProjectID, "USERID_MOBILE", m.ID)
|
||||
return nil
|
||||
case *MobileUserAnonymousID:
|
||||
if err = s.sessions.UpdateAnonymousID(session.SessionID, m.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
s.pg.InsertAutocompleteValue(session.SessionID, session.ProjectID, "USERANONYMOUSID_Mobile", m.ID)
|
||||
s.pg.InsertAutocompleteValue(session.SessionID, session.ProjectID, "USERANONYMOUSID_MOBILE", m.ID)
|
||||
return nil
|
||||
case *MobileMetadata:
|
||||
return s.sessions.UpdateMetadata(m.SessionID(), m.Key, m.Value)
|
||||
|
|
|
|||
|
|
@ -132,8 +132,15 @@ func (conn *Conn) InsertWebClickEvent(sess *sessions.Session, e *messages.MouseC
|
|||
}
|
||||
var host, path string
|
||||
host, path, _, _ = url.GetURLParts(e.Url)
|
||||
if e.NormalizedX <= 100 && e.NormalizedY <= 100 {
|
||||
if err := conn.bulks.Get("webClickXYEvents").Append(sess.SessionID, truncSqIdx(e.MsgID()), e.Timestamp, e.Label, e.Selector, host+path, path, e.HesitationTime, e.NormalizedX, e.NormalizedY); err != nil {
|
||||
if e.NormalizedX != 101 && e.NormalizedY != 101 {
|
||||
// To support previous versions of tracker
|
||||
if e.NormalizedX <= 100 && e.NormalizedY <= 100 {
|
||||
e.NormalizedX *= 100
|
||||
e.NormalizedY *= 100
|
||||
}
|
||||
normalizedX := float32(e.NormalizedX) / 100.0
|
||||
normalizedY := float32(e.NormalizedY) / 100.0
|
||||
if err := conn.bulks.Get("webClickXYEvents").Append(sess.SessionID, truncSqIdx(e.MsgID()), e.Timestamp, e.Label, e.Selector, host+path, path, e.HesitationTime, normalizedX, normalizedY); err != nil {
|
||||
sessCtx := context.WithValue(context.Background(), "sessionID", sess.SessionID)
|
||||
conn.log.Error(sessCtx, "insert web click event in bulk err: %s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ func (conn *Conn) InsertMobileEvent(session *sessions.Session, e *messages.Mobil
|
|||
if err := conn.InsertCustomEvent(session.SessionID, e.Timestamp, truncSqIdx(e.Index), e.Name, e.Payload); err != nil {
|
||||
return err
|
||||
}
|
||||
conn.InsertAutocompleteValue(session.SessionID, session.ProjectID, "CUSTOM_Mobile", e.Name)
|
||||
conn.InsertAutocompleteValue(session.SessionID, session.ProjectID, "CUSTOM_MOBILE", e.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (conn *Conn) InsertMobileNetworkCall(sess *sessions.Session, e *messages.MobileNetworkCall) error {
|
||||
err := conn.InsertRequest(sess.SessionID, e.Timestamp, truncSqIdx(e.Index), e.URL, e.Duration, e.Status < 400)
|
||||
if err == nil {
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "REQUEST_Mobile", url.DiscardURLQuery(e.URL))
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "REQUEST_MOBILE", url.DiscardURLQuery(e.URL))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ func (conn *Conn) InsertMobileClickEvent(sess *sessions.Session, clickEvent *mes
|
|||
); err != nil {
|
||||
return err
|
||||
}
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "CLICK_Mobile", clickEvent.Label)
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "CLICK_MOBILE", clickEvent.Label)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ func (conn *Conn) InsertMobileSwipeEvent(sess *sessions.Session, swipeEvent *mes
|
|||
); err != nil {
|
||||
return err
|
||||
}
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "SWIPE_Mobile", swipeEvent.Label)
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "SWIPE_MOBILE", swipeEvent.Label)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ func (conn *Conn) InsertMobileInputEvent(sess *sessions.Session, inputEvent *mes
|
|||
); err != nil {
|
||||
return err
|
||||
}
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "INPUT_Mobile", inputEvent.Label)
|
||||
conn.InsertAutocompleteValue(sess.SessionID, sess.ProjectID, "INPUT_MOBILE", inputEvent.Label)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -397,12 +397,19 @@ func (c *connectorImpl) InsertWebClickEvent(session *sessions.Session, msg *mess
|
|||
if msg.Label == "" {
|
||||
return nil
|
||||
}
|
||||
var nX *uint8 = nil
|
||||
var nY *uint8 = nil
|
||||
if msg.NormalizedX <= 100 && msg.NormalizedY <= 100 {
|
||||
nXVal := uint8(msg.NormalizedX)
|
||||
var nX *float32 = nil
|
||||
var nY *float32 = nil
|
||||
if msg.NormalizedX != 101 && msg.NormalizedY != 101 {
|
||||
// To support previous versions of tracker
|
||||
if msg.NormalizedX <= 100 && msg.NormalizedY <= 100 {
|
||||
msg.NormalizedX *= 100
|
||||
msg.NormalizedY *= 100
|
||||
}
|
||||
normalizedX := float32(msg.NormalizedX) / 100.0
|
||||
normalizedY := float32(msg.NormalizedY) / 100.0
|
||||
nXVal := normalizedX
|
||||
nX = &nXVal
|
||||
nYVal := uint8(msg.NormalizedY)
|
||||
nYVal := normalizedY
|
||||
nY = &nYVal
|
||||
}
|
||||
if err := c.batches["clicks"].Append(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue