Documentation ¶
Index ¶
- Variables
- func CountryCodeFromRequest(r *http.Request) string
- func DeviceFromUserAgent(userAgent string) *proto.Device
- func EventTypes(eventTypesMap ...map[string]uint32) []string
- func GenSessionID() string
- func ProxyHandler(databeatHost string) func(next http.Handler) http.Handler
- func String(s string) *string
- func StructToProps(v any) (map[string]string, map[string]float64, map[string]interface{}, error)
- func TimeNow() *time.Time
- type Databeat
- func (t *Databeat) Flush(ctx context.Context) error
- func (t *Databeat) IsRunning() bool
- func (t *Databeat) Options() Options
- func (t *Databeat) Reset()
- func (t *Databeat) Run(ctx context.Context) error
- func (t *Databeat) Stats() Stats
- func (t *Databeat) Stop()
- func (t *Databeat) Track(events ...*Event)
- func (t *Databeat) TrackEvent(from From, trackEvents ...Event)
- func (t *Databeat) TrackRaw(events ...*RawEvent)
- func (t *Databeat) TrackUserEvent(r *http.Request, userID string, userEvents ...Event)
- type Device
- type Event
- type From
- type Ident
- type Options
- type PrivacyOptions
- type Props
- type RawEvent
- type Stats
- type ToEventProps
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = Options{ Privacy: DefaultPrivacyOptions, AssertEventTypes: []string{}, FlushBatchSize: 100, FlushInterval: 2000 * time.Millisecond, FlushTimeout: 30 * time.Second, FlushConcurrency: 10, MaxQueueSize: 10_000, SetServerClientProp: false, HTTPClient: &http.Client{}, }
View Source
var DefaultPrivacyOptions = PrivacyOptions{ UserIDHash: true, UserAgentSalt: false, ExtraSalt: "", }
Functions ¶
func CountryCodeFromRequest ¶ added in v0.2.2
func DeviceFromUserAgent ¶ added in v0.2.0
func EventTypes ¶ added in v0.2.0
func GenSessionID ¶ added in v0.2.0
func GenSessionID() string
func ProxyHandler ¶
ProxyHandler routes requests from /rpc/Databeat/* to the remote Databeat server.
func StructToProps ¶ added in v0.4.0
Types ¶
type Databeat ¶
type Databeat struct { Client proto.Databeat Enabled bool // contains filtered or unexported fields }
func NewDatabeatClient ¶
func (*Databeat) Track ¶
Track is a low-level track function where you control the full payload. The method TrackUserEvent calls Track as well.
func (*Databeat) TrackEvent ¶ added in v0.6.0
func (*Databeat) TrackUserEvent ¶ added in v0.3.0
TrackUserEvent will track the event associated to a particular user. We use the http request `r` for User-Agent and IP information. Note that `r` is optional, and you can pass `nil` as the argument, but it will be unable to offer device and country information.
type Ident ¶ added in v0.3.0
type Ident uint8
func GenUserID ¶ added in v0.3.0
func GenUserID(userID string, privacyOptions PrivacyOptions) (string, Ident)
func GenUserIDFromRequest ¶ added in v0.3.0
type PrivacyOptions ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.