Measurement Protocol (Google Analytics 4) docs reference: https://developers.google.com/analytics/devguides/collection/protocol/ga4
Debugging tools: https://ga-dev-tools.google/ga4/event-builder/
package main
import (
"fmt"
"github.com/ad/ga4"
)
func main() {
client := ga4.NewGA4Client("G-XXXXXXXXXX", "xxxxxxxxxxxxxxxxxxxxx", "", true)
err := client.SendEvent(
ga4.Event{
Name: "test_event",
Params: map[string]string{
"param1": "value1",
"param2": "value2",
},
},
)
if err != nil {
fmt.Println(err)
}
}