aptabase

package
v0.0.0-...-2d0f170 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SDKVersion string // This will hold the version at build time

Functions

func GetVersion

func GetVersion() string

GetVersion retrieves the SDK version for use in the application.

Types

type Client

type Client struct {
	APIKey         string
	BaseURL        string
	HTTPClient     *http.Client
	SessionID      string
	LastTouch      time.Time
	SessionTimeout time.Duration

	AppVersion     string
	AppBuildNumber uint64
	DebugMode      bool

	Quit   bool
	Logger *log.Logger // Logger field added
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey, appVersion string, appBuildNumber uint64, debugMode bool, baseURL string) *Client

NewClient Initializes a new client and begins processing events automagically.

func (*Client) EvalSessionID

func (c *Client) EvalSessionID() string

EvalSessionID evaluates and updates the session ID if the session has expired.

func (*Client) NewSessionID

func (c *Client) NewSessionID() string

NewSessionID generates a new session ID in the format of epochInSeconds + 8 random numbers.

func (*Client) Stop

func (c *Client) Stop()

Stop gracefully stops the event processing and sends any remaining events.

func (*Client) TrackEvent

func (c *Client) TrackEvent(event EventData)

TrackEvent queues an event with the specified EventData for tracking.

type EventData

type EventData struct {
	EventName   string                 `json:"eventName"`
	Props       map[string]interface{} `json:"props"`
	Timestamp   string                 `json:"Timestamp"`
	SessionId   string                 `json:"SessionId"`
	SystemProps map[string]interface{} `json:"SystemProps"`
}

EventData represents the structure of the event data passed to TrackEvent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL