# README
Customer.io Data Pipelines analytics client for Go.
Installation
go get github.com/customerio/cdp-analytics-go
Usage
package main
import (
"os"
"github.com/customerio/cdp-analytics-go"
)
func main() {
client := analytics.New(os.Getenv("WRITE_KEY"))
// Enqueues a track event that will be sent asynchronously.
client.Enqueue(analytics.Track{
UserId: "4",
Event: "order_complete",
})
// Flushes any queued messages and closes the client.
client.Close()
}
Other Regions
If you're using a different data center such as our EU region, you can specify an alternate endpoint:
package main
import (
"os"
"github.com/customerio/cdp-analytics-go"
)
func main() {
client, err := analytics.NewWithConfig(os.Getenv("WRITE_KEY"), analytics.Config{
Endpoint: "https://cdp-eu.customer.io",
})
if err != nil {
panic(err)
}
// ...
}
Documentation
The links below contain more detailed documentation on how to use this library:
# 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.
No description provided by the author
# Constants
This constant sets the default batch size used by client instances if none was explicitly set.
This constant sets the default endpoint to which client instances send messages if none was explictly set.
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.
No description provided by the author
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