fix: session id

This commit is contained in:
Kevin Franklin Kim 2024-03-12 09:16:37 +01:00
parent f8908a6dd1
commit 67a90c8a8d
No known key found for this signature in database

View File

@ -66,8 +66,8 @@ func MiddlewarSessionID(trackingID string) ClientMiddleware {
return func(next ClientHandler) ClientHandler {
return func(r *http.Request, event *Event) error {
if value, _ := r.Cookie("_ga_" + trackingID); value != nil {
if value := strings.Split(strings.TrimPrefix(value.Value, "GA1.1."), "."); len(value) > 0 {
event.SessionID = &value[0]
if value := strings.Split(value.Value, "."); len(value) > 3 {
event.SessionID = &value[2]
}
}
return next(r, event)