Documentation ¶
Overview ¶
ingest implements Deduce data ingestion
Index ¶
Constants ¶
const ( VERSION = "1.1" COLLECT_URL = "//lore.deduce.com/p/collect" EVENT_URL = "https://event.deduce.com/p/event" // always https TIMEOUT = 2 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func WithBackfill ¶
WithBackfill can be used to enable backfill mode
dd, err := ingest.New("my site id", "my api key", ingest.WithBackfill)
func WithOutSSL ¶
func WithTestmode ¶
WithTestmode can be used to enable testmode
dd, err := ingest.New("my site id", "my api key", ingest.WithTestmode)
func WithWhatEvs ¶
Types ¶
type D ¶
type D struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new ingestion object
dd, err := ingest.New("my site id", "my api key")
or enable test mode:
dd, err := ingest.New("my site id", "my api key", ingest.WithTestmode)
func (*D) Event ¶
Event sends an event to Deduce
err := dd.Event(email, ip, event, additional)
additional should be a map[string]interface{} (or nil)
consult with Deduce to determine the event types and additional data. email, as well as any "cc" and "email_prev" will automatically be hashed + processed.
err := dd.Event("user@example.com", "192.0.2.37", "ate-food", nil) err := dd.Event("user@example.com", "192.0.2.37", "ate-food", map[string]interface{}{ "name": "Bob Example", "weight": 1230, "meal": map[string]string{"color": "orange", "flavor": "salty"}, })
func (*D) Events ¶
Events sends several related events to Deduce
the events should be a slice of map[string]interface{} and should contain values for the event, ip, and email.
consult with Deduce to determine the event types and additional data. email, as well as any "cc" and "email_prev" will automatically be hashed + processed.
err := dd.Events( []map[string]interface{}{ { "event": "thing-happened", "email": "user1@example.com", "ip": "192.0.2.37" }, { "event": "thing-happened", "email": "user2@example.com", "ip": "192.0.2.38" }, })
type FunOpt ¶
func WithInspector ¶
func WithTimeout ¶
WithTimeout can be used to change the event POST timeout
err := dd.Event(..., ingest.WithTimeout(10*time.Second))