mirror of
https://github.com/foomo/sesamy-go.git
synced 2025-10-16 12:35:43 +00:00
fix: don't use tft timestamp
This commit is contained in:
parent
2770d4f32f
commit
fe5b8c9f0f
@ -151,9 +151,16 @@ func (l *Loki) Write(payload mpv2.Payload[any]) {
|
|||||||
l.l.Warn("buffer size reached", zap.Int("size", l.bufferSize))
|
l.l.Warn("buffer size reached", zap.Int("size", l.bufferSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var timestamp time.Time
|
||||||
|
if payload.TimestampMicros > 0 {
|
||||||
|
timestamp = time.UnixMicro(payload.TimestampMicros)
|
||||||
|
} else {
|
||||||
|
timestamp = time.Now()
|
||||||
|
}
|
||||||
|
|
||||||
l.entries <- logproto.Entry{
|
l.entries <- logproto.Entry{
|
||||||
Line: string(lineBytes),
|
Line: string(lineBytes),
|
||||||
Timestamp: time.UnixMicro(payload.TimestampMicros),
|
Timestamp: timestamp,
|
||||||
StructuredMetadata: push.LabelsAdapter{
|
StructuredMetadata: push.LabelsAdapter{
|
||||||
{
|
{
|
||||||
Name: "event_name",
|
Name: "event_name",
|
||||||
|
|||||||
@ -13,7 +13,7 @@ type SST struct {
|
|||||||
GCSub *string `json:"gcsub,omitempty" gtag:"gcsub,omitempty"`
|
GCSub *string `json:"gcsub,omitempty" gtag:"gcsub,omitempty"`
|
||||||
// Example: DE
|
// Example: DE
|
||||||
UC *string `json:"uc,omitempty" gtag:"uc,omitempty"`
|
UC *string `json:"uc,omitempty" gtag:"uc,omitempty"`
|
||||||
// Example: 1708250245344
|
// Session start time, time first seen. Example: 1708250245344
|
||||||
TFT *string `json:"tft,omitempty" gtag:"tft,omitempty"`
|
TFT *string `json:"tft,omitempty" gtag:"tft,omitempty"`
|
||||||
// Example: 13l3l3l3l1
|
// Example: 13l3l3l3l1
|
||||||
GCD *string `json:"gcd,omitempty" gtag:"gcd,omitempty"`
|
GCD *string `json:"gcd,omitempty" gtag:"gcd,omitempty"`
|
||||||
|
|||||||
@ -29,9 +29,6 @@ func MPv2(source gtag.Payload, target any) error {
|
|||||||
"non_personalized_ads": source.NonPersonalizedAds,
|
"non_personalized_ads": source.NonPersonalizedAds,
|
||||||
"debug_mode": source.IsDebug,
|
"debug_mode": source.IsDebug,
|
||||||
}
|
}
|
||||||
if source.SST != nil && source.SST.TFT != nil {
|
|
||||||
targetData["timestamp_micros"] = gtag.Get(source.SST.TFT) + "000"
|
|
||||||
}
|
|
||||||
|
|
||||||
// combine user properties
|
// combine user properties
|
||||||
targetUserProperties := map[string]any{}
|
targetUserProperties := map[string]any{}
|
||||||
|
|||||||
@ -3,5 +3,6 @@ package params
|
|||||||
// PageView https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag#manually_send_page_view_events
|
// PageView https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag#manually_send_page_view_events
|
||||||
type PageView struct {
|
type PageView struct {
|
||||||
PageTitle string `json:"page_title,omitempty"`
|
PageTitle string `json:"page_title,omitempty"`
|
||||||
|
PageReferrer string `json:"page_referrer,omitempty"`
|
||||||
PageLocation string `json:"page_location,omitempty"`
|
PageLocation string `json:"page_location,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user