analytics

package
v3.31.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ISO8601 = "2006-01-02T15:04:05Z"

Variables

This section is empty.

Functions

This section is empty.

Types

type ABTest

type ABTest struct {
	Name     string
	Variants []Variant
	EndAt    time.Time
}

ABTest presents an AB test input as sent to the Analytics API when creating a new AB test.

func (ABTest) MarshalJSON

func (abTest ABTest) MarshalJSON() ([]byte, error)

type ABTestResponse

type ABTestResponse struct {
	ABTestID               int               `json:"abTestID"`
	ClickSignificance      float64           `json:"clickSignificance"`
	ConversionSignificance float64           `json:"conversionSignificance"`
	CreatedAt              time.Time         `json:"createdAt"`
	UpdatedAt              time.Time         `json:"updatedAt"`
	EndAt                  time.Time         `json:"endAt"`
	Name                   string            `json:"name"`
	Status                 string            `json:"status"`
	Variants               []VariantResponse `json:"variants"`
}

ABTestResponse represents an AB test as returned by the Analytics API when retrieved as part of a response.

type ABTestTaskRes

type ABTestTaskRes struct {
	ABTestID int    `json:"abTestID"`
	Index    string `json:"index"`
	TaskID   int64  `json:"taskID"`
	// contains filtered or unexported fields
}

ABTestTaskRes represents a generic task submitted to the Analytics API for an AB test.

func (ABTestTaskRes) Wait

func (r ABTestTaskRes) Wait() error

Wait blocks until the AB test task completes or if there is an error while waiting for its completion.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides methods to interact with the Algolia Analytics API.

func NewClient

func NewClient(appID, apiKey string) *Client

NewClient instantiates a new client able to interact with the Algolia Analytics API.

func NewClientWithConfig

func NewClientWithConfig(config Configuration) *Client

NewClientWithConfig instantiates a new client able to interact with the Algolia Analytics API.

func (*Client) AddABTest

func (c *Client) AddABTest(abTest ABTest, opts ...interface{}) (res ABTestTaskRes, err error)

AddABTest creates a new AB test.

func (*Client) DeleteABTest

func (c *Client) DeleteABTest(id int, opts ...interface{}) (res ABTestTaskRes, err error)

DeleteABTest effectively deletes the AB test with the given ID, making it both disabled and unreachable afterwards i.e. AB tests results are not available anymore.

func (*Client) GetABTest

func (c *Client) GetABTest(id int, opts ...interface{}) (res ABTestResponse, err error)

GetABTest returns the AB test content and results for the given ID.

func (*Client) GetABTests

func (c *Client) GetABTests(opts ...interface{}) (res GetABTestsRes, err error)

GetABTests returns a list of AB tests according to any opt.Offset or opt.Limit parameters.

func (*Client) StopABTest

func (c *Client) StopABTest(id int, opts ...interface{}) (res ABTestTaskRes, err error)

StopABTest stops the AB test with the given ID, which means that this specific AB test will not be triggered anymore. However, the AB test and its associated results are still accessible.

type Configuration

type Configuration struct {
	AppID          string
	APIKey         string
	Hosts          []string
	Requester      transport.Requester
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	Region         region.Region
	Headers        map[string]string
	ExtraUserAgent string
}

Configuration contains all the different parameters one can change to instantiate a new client for the Analytics API.

type GetABTestsRes

type GetABTestsRes struct {
	ABTests []ABTestResponse `json:"abtests"`
	Count   int              `json:"count"`
	Total   int              `json:"total"`
}

GetABTestsRes represents a response payload from the Analytics API when performing a GetABTests call.

type Variant

type Variant struct {
	Index                  string              `json:"index"`
	TrafficPercentage      int                 `json:"trafficPercentage"`
	Description            string              `json:"description,omitempty"`
	CustomSearchParameters *search.QueryParams `json:"customSearchParameters,omitempty"`
}

Variant presents a Variant input as sent to the Analytics API when creating a new AB test.

type VariantResponse

type VariantResponse struct {
	AverageClickPosition   float64             `json:"averageClickPosition"`
	ClickCount             int                 `json:"clickCount"`
	ClickThroughRate       float64             `json:"clickThroughRate"`
	ConversionCount        int                 `json:"conversionCount"`
	ConversionRate         float64             `json:"conversionRate"`
	Description            string              `json:"description"`
	Index                  string              `json:"index"`
	NoResultCount          int                 `json:"noResultCount"`
	SearchCount            int                 `json:"searchCount"`
	TrackedSearchCount     int                 `json:"trackedSearchCount"`
	TrafficPercentage      int                 `json:"trafficPercentage"`
	UserCount              int                 `json:"userCount"`
	CustomSearchParameters *search.QueryParams `json:"customSearchParameters,omitempty"`
}

VariantResponse represents an AB test's variant as returned by the Analytics API when retrieved as part of a response.

Jump to

Keyboard shortcuts

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