Categorygithub.com/rudderlabs/analytics-go
modulepackage
3.3.3+incompatible
Repository: https://github.com/rudderlabs/analytics-go.git
Documentation: pkg.go.dev

# README

Installation

The package can be simply installed via "go get", we recommend that you use a tool like Godep to avoid issues related to API breaking changes introduced between major versions of the library.

To install it in the GOPATH:

go get github.com/rudderlabs/analytics-go

Usage

package main

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

func main() {
    // Instantiates a client to use send messages to the Rudder API.
    // User your WRITE KEY in below placeholder "RUDDER WRITE KEY"
    client := analytics.New(<WRITE_KEY>, <DATA_PLANE_URL>)

    // Enqueues a track event that will be sent asynchronously.
    client.Enqueue(analytics.Track{
        UserId: "test-user",
        Event:  "test-snippet",
    })

    // Flushes any queued messages and closes the client.
    client.Close()
}

OR

package main

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

func main() {
    // Instantiates a client to use send messages to the Rudder API.
    // User your WRITE KEY in below placeholder "RUDDER WRITE KEY"
    client, _ := analytics.NewWithConfig(<WRITE_KEY>, <DATA_PLANE_URL>,
		analytics.Config{
			Interval:  30 * time.Second,
			BatchSize: 100,
			Verbose:   true,
		})

    // Enqueues a track event that will be sent asynchronously.
    client.Enqueue(analytics.Track{
        UserId: "test-user",
        Event:  "test-snippet",
    })

    // Flushes any queued messages and closes the client.
    client.Close()
}

License

The library is released under the MIT license.

# Packages

No description provided by the author

# Functions

Instantiate a new client that uses the write key passed as first argument to send messages to the backend.
No description provided by the author
No description provided by the author
No description provided by the author
Instantiate a new client that uses the write key and configuration passed as arguments to send messages to the backend.
This function instantiate an object that statisfies the analytics.Logger interface and send logs to standard logger passed as argument.

# Constants

This constant sets the default batch size used by client instances if none was explicitly set.
No description provided by the author
This constant sets the default flush interval used by client instances if none was explicitly set.
Version of the client.

# Variables

This error is returned by methods of the `Client` interface when they are called after the client was already closed.
This error is used to notify the client callbacks that a message send failed because the JSON representation of a message exceeded the upper limit.
This error is used to notify the application that too many requests are already being sent and no more messages can be accepted.

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
Instances of this type carry the different configuration options that may be set when instantiating a client.
Returned by the `NewWithConfig` function when the one of the configuration fields was set to an impossible value (like a negative duration).
No description provided by the author
No description provided by the author
Instances of this type are used to represent errors returned when a field was no initialize properly in a structure passed as argument to one of the functions of this package.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
This type represents products in the E-commerce API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

Values implementing this interface are used by analytics clients to notify the application when a message send succeeded or failed.
This interface is the main API exposed by the analytics package.
Instances of types implementing this interface can be used to define where the analytics client logs are written.
This interface is used to represent analytics objects that can be sent via a client.

# Type aliases

No description provided by the author
This type is used to represent properties in messages that support it.
No description provided by the author