https://github.com/olebedev/go-gamp
Google Analytics Measurement Protocol in Golang
https://github.com/olebedev/go-gamp
gamp golang google-analytics
Last synced: 9 months ago
JSON representation
Google Analytics Measurement Protocol in Golang
- Host: GitHub
- URL: https://github.com/olebedev/go-gamp
- Owner: olebedev
- Created: 2017-08-02T17:40:11.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-09-29T06:24:58.000Z (almost 7 years ago)
- Last Synced: 2025-03-31T01:51:15.351Z (over 1 year ago)
- Topics: gamp, golang, google-analytics
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 16
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gamp [](https://godoc.org/github.com/olebedev/go-gamp)
> [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/reference) in Golang
Almost full API implementation, except dynamic parameters(due to swagger 2.0 is not supported it yet) and batch mode.
### Example
```golang
package main
import (
"log"
"context"
"github.com/AlekSi/pointer"
gamp "github.com/olebedev/go-gamp"
"github.com/olebedev/go-gamp/client/gampops"
)
func main() {
client := gamp.New(context.Background(), "UA-XXXXXXXX-X")
err := client.Collect(
gampops.NewCollectParams().
WithCid(pointer.ToString("42")).
WithT("event").
WithEc(pointer.ToString("Category")).
WithEa(pointer.ToString("Action")),
)
if err != nil {
log.Fatal(err)
}
}
```