/analytics-go

Go Amplitude Analytics SDK

Primary LanguageGoMIT LicenseMIT


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 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: "type-of-event",
		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.