https://github.com/ad/ga4
ga4 go
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/ad/ga4
- Owner: ad
- License: mit
- Created: 2024-02-23T07:27:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-16T11:01:38.000Z (almost 2 years ago)
- Last Synced: 2025-01-25T20:11:24.183Z (over 1 year ago)
- Topics: ga4, go
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ga4
## package for sending events to Google Analytics 4 using the Measurement Protocol
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/
### Usage
```go
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)
}
}
```