From f5988637609f5f36e3d8a73c674b5937c04ba1b8 Mon Sep 17 00:00:00 2001 From: LiKang6688 Date: Thu, 18 Jun 2026 19:37:25 +0200 Subject: [PATCH] Fix README install command, usage example, and batch defaults. Align env var naming with developer docs and correct the default BatchSize to 250. Co-authored-by: Cursor --- Readme.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Readme.md b/Readme.md index 3fa87df..f2c29f2 100644 --- a/Readme.md +++ b/Readme.md @@ -11,7 +11,7 @@ versions of the library. To install it in the GOPATH: ``` -go get https://github.com/dreamdata-io/analytics-go +go get github.com/dreamdata-io/analytics-go ``` ## Usage @@ -21,18 +21,17 @@ package main import ( "os" - "golang.org/x/sync/errgroup" "github.com/dreamdata-io/analytics-go" ) func main() { // Instantiates a client to send messages to the dreamdata API. - client := analytics.New(os.Getenv("DREAMDATA_WRITE_KEY")) + client := analytics.New(os.Getenv("DREAMDATA_API_KEY")) var err error - err = c.Enqueue(analytics.Identify{ + err = client.Enqueue(analytics.Identify{ UserId: "019mr8mf4r", Traits: analytics.NewTraits(). SetEmail("user@dreamdata.io"). @@ -43,7 +42,7 @@ func main() { // do something with your err } - err = c.Enqueue(analytics.Track{ + err = client.Enqueue(analytics.Track{ UserId: "019mr8mf4r", Event: "Song Played", Properties: analytics.NewProperties(). @@ -54,7 +53,7 @@ func main() { // do something with your err } - err = c.Enqueue(analytics.Identify{ + err = client.Enqueue(analytics.Identify{ UserId: "971mj8mk7p", Traits: analytics.NewTraits(). SetEmail("user2@dreamdata.io"). @@ -65,7 +64,7 @@ func main() { // do something with your err } - err = c.Enqueue(analytics.Track{ + err = client.Enqueue(analytics.Track{ UserId: "971mj8mk7p", Event: "Song Played", Properties: analytics.NewProperties(). @@ -86,13 +85,13 @@ Every method you call does not result in an HTTP request, but is queued in memor By default, our library will flush: -- Every 20 messages (controlled by `Config.BatchSize`). +- Every 250 messages (controlled by `Config.BatchSize`). - If 5 seconds has passed since the last flush (controlled by `Config.Interval`) - There is a maximum of 500KB per batch request and 32KB per call. If you don’t want to batch messages, you can turn batching off by setting the BatchSize option to 1, like so: ```go -c, err := analytics.NewWithConfig(os.Getenv("DREAMDATA_WRITE_KEY"), analytics.Config{BatchSize: 1}) +client, err := analytics.NewWithConfig(os.Getenv("DREAMDATA_API_KEY"), analytics.Config{BatchSize: 1}) ``` ## Disclaimer