mirror of
https://github.com/foomo/sesamy-go.git
synced 2025-10-16 12:35:43 +00:00
fix: try float
This commit is contained in:
parent
cfe639e0e7
commit
8ad1c6cee5
@ -2,7 +2,9 @@ package gtagencode
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"maps"
|
"maps"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/foomo/sesamy-go/pkg/encoding/gtag"
|
"github.com/foomo/sesamy-go/pkg/encoding/gtag"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
@ -60,7 +62,11 @@ func MPv2(source gtag.Payload, target any) error {
|
|||||||
}
|
}
|
||||||
if node, ok := sourceData["event_parameter_number"].(map[string]any); ok {
|
if node, ok := sourceData["event_parameter_number"].(map[string]any); ok {
|
||||||
for s, s2 := range node {
|
for s, s2 := range node {
|
||||||
targetEventDataParams[s] = s2
|
if value, err := strconv.ParseFloat(fmt.Sprintf("%s", s2), 64); err == nil {
|
||||||
|
targetEventDataParams[s] = value
|
||||||
|
} else {
|
||||||
|
targetEventDataParams[s] = s2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
targetEventData["params"] = targetEventDataParams
|
targetEventData["params"] = targetEventDataParams
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user