fix: transform debug mode

This commit is contained in:
Kevin Franklin Kim 2024-07-09 07:57:20 +02:00
parent dced802d6a
commit f8fcacca2a
No known key found for this signature in database

View File

@ -20,12 +20,13 @@ func MPv2(source gtag.Payload, target any) error {
return errors.Wrap(err, "failed to unmarshal source") return errors.Wrap(err, "failed to unmarshal source")
} }
// transorm map to match mpv2 format // transform map to match mpv2 format
targetData := map[string]any{ targetData := map[string]any{
"client_id": source.ClientID, "client_id": source.ClientID,
"user_id": source.UserID, "user_id": source.UserID,
"non_personalized_ads": source.NonPersonalizedAds, "non_personalized_ads": source.NonPersonalizedAds,
"timestamp_micros": source.SST.TFT, "timestamp_micros": source.SST.TFT,
"debug_mode": source.IsDebug,
} }
if source.SST != nil && source.SST.TFT != nil { if source.SST != nil && source.SST.TFT != nil {
targetData["timestamp_micros"] = gtag.Get(source.SST.TFT) + "000" targetData["timestamp_micros"] = gtag.Get(source.SST.TFT) + "000"