• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..26-Oct-2021-

.gitignoreH A D26-Oct-2021306 3325

.gitmodulesH A D26-Oct-2021255 76

License.mdH A D26-Oct-20211.1 KiB2217

Readme.mdH A D26-Oct-20211.5 KiB7153

alias.goH A D26-Oct-20211 KiB4532

analytics.goH A D26-Oct-202114.2 KiB599447

config.goH A D26-Oct-20215.2 KiB17982

context.goH A D26-Oct-20214.9 KiB14996

error.goH A D26-Oct-20211.9 KiB6126

executor.goH A D26-Oct-2021675 5443

group.goH A D26-Oct-20211.1 KiB4734

identify.goH A D26-Oct-20211,016 3826

integrations.goH A D26-Oct-20211.1 KiB4521

json.goH A D26-Oct-20212.1 KiB8859

logger.goH A D26-Oct-20211.3 KiB4826

message.goH A D26-Oct-20213.4 KiB13279

page.goH A D26-Oct-20211 KiB3927

properties.goH A D26-Oct-20212.8 KiB11878

screen.goH A D26-Oct-20211 KiB3927

timeout_15.goH A D26-Oct-2021355 179

timeout_16.goH A D26-Oct-2021195 115

track.goH A D26-Oct-20211.1 KiB4734

traits.goH A D26-Oct-20211.9 KiB9055

Readme.md

1
2## Installation
3
4The package can be simply installed via "go get", we recommend that you use a tool like
5Godep to avoid issues related to API breaking changes introduced between major
6versions of the library.
7
8To install it in the GOPATH:
9```
10go get github.com/rudderlabs/analytics-go
11```
12
13
14## Usage
15
16```go
17package main
18
19import (
20    "github.com/rudderlabs/analytics-go"
21)
22
23func main() {
24    // Instantiates a client to use send messages to the Rudder API.
25    // User your WRITE KEY in below placeholder "RUDDER WRITE KEY"
26    client := analytics.New(<WRITE_KEY>, <DATA_PLANE_URL>)
27
28    // Enqueues a track event that will be sent asynchronously.
29    client.Enqueue(analytics.Track{
30        UserId: "test-user",
31        Event:  "test-snippet",
32    })
33
34    // Flushes any queued messages and closes the client.
35    client.Close()
36}
37```
38OR
39```go
40package main
41
42import (
43    "github.com/rudderlabs/analytics-go"
44)
45
46func main() {
47    // Instantiates a client to use send messages to the Rudder API.
48    // User your WRITE KEY in below placeholder "RUDDER WRITE KEY"
49    client, _ := analytics.NewWithConfig(<WRITE_KEY>, <DATA_PLANE_URL>,
50		analytics.Config{
51			Interval:  30 * time.Second,
52			BatchSize: 100,
53			Verbose:   true,
54		})
55
56    // Enqueues a track event that will be sent asynchronously.
57    client.Enqueue(analytics.Track{
58        UserId: "test-user",
59        Event:  "test-snippet",
60    })
61
62    // Flushes any queued messages and closes the client.
63    client.Close()
64}
65```
66
67
68## License
69
70The library is released under the [MIT license](License.md).
71