Skip to content

Google Analytics Measurement Protocol in Golang

Notifications You must be signed in to change notification settings

olebedev/go-gamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gamp GoDoc

Google Analytics Measurement Protocol in Golang

Almost full API implementation, except dynamic parameters(due to swagger 2.0 is not supported it yet) and batch mode.

Example

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)
	}
}

About

Google Analytics Measurement Protocol in Golang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published