moubry / analytics-go

Go Amplitude Analytics SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Build go-doc

Announcement 📣

Amplitude is introducing Go SDK. Compared to plain HTTP V2 API, it provides improved developer experience, helps users instrument data more seamlessly and provides more control over data being instrumented using custom plugins.

To learn more about the new SDK, here are some useful links:

Official Amplitude Go SDK

This is Amplitude's latest and official version of Go SDK.

Installation

Install analytics-go using go get:

go get https://github.com/amplitude/analytics-go

Usage

package main

import (
	"github.com/amplitude/analytics-go/amplitude"
)

func main() {

	config := amplitude.NewConfig("your-api-key")

	client := amplitude.NewClient(config)

	// Track a basic event
	// One of UserID and DeviceID is required
	client.Track(amplitude.Event{
		EventType: "Button Clicked",
		EventOptions: amplitude.EventOptions{
			UserID: "user-id",
		},
	})

	// Flushed queued events and shutdown the client
	client.Shutdown()
}

Need Help?

If you have any issues using our SDK, feel free to create a GitHub issue or submit a request on Amplitude Help.

About

Go Amplitude Analytics SDK

License:MIT License


Languages

Language:Go 100.0%