Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olebedev/go-gamp
Google Analytics Measurement Protocol in Golang
https://github.com/olebedev/go-gamp
gamp golang google-analytics
Last synced: 2 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 (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-29T06:24:58.000Z (over 5 years ago)
- Last Synced: 2024-10-04T13:39:54.652Z (3 months ago)
- Topics: gamp, golang, google-analytics
- Language: Go
- Homepage:
- Size: 19.5 KB
- Stars: 17
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gamp [![GoDoc](https://godoc.org/github.com/olebedev/go-gamp?status.svg)](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 mainimport (
"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)
}
}
```