Documentation ¶
Index ¶
- Constants
- type Client
- type ClientInterface
- type Configuration
- type Event
- type ObjectData
- type StatusMessageRes
- type UserClient
- func (c *UserClient) ClickedFilters(eventName string, indexName string, filters []string, opts ...interface{}) (res StatusMessageRes, err error)
- func (c *UserClient) ClickedObjectIDs(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ClickedObjectIDsAfterSearch(eventName string, indexName string, objectIDs []string, positions []int, ...) (StatusMessageRes, error)
- func (c *UserClient) ConvertedFilters(eventName string, indexName string, filters []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ConvertedFiltersAddToCart(eventName string, indexName string, filters []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ConvertedFiltersPurchase(eventName string, indexName string, filters []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ConvertedObjectIDs(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ConvertedObjectIDsAddToCart(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ConvertedObjectIDsAfterSearch(eventName string, indexName string, objectIDs []string, queryID string, ...) (StatusMessageRes, error)
- func (c *UserClient) ConvertedObjectIDsAfterSearchAddToCart(eventName string, indexName string, objectIDs []string, queryID string, ...) (StatusMessageRes, error)
- func (c *UserClient) ConvertedObjectIDsAfterSearchPurchase(eventName string, indexName string, objectIDs []string, queryID string, ...) (StatusMessageRes, error)
- func (c *UserClient) ConvertedObjectIDsPurchase(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ViewedFilters(eventName string, indexName string, filters []string, opts ...interface{}) (StatusMessageRes, error)
- func (c *UserClient) ViewedObjectIDs(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error)
- type UserClientInterface
Constants ¶
const ( EventTypeClick = "click" EventTypeConversion = "conversion" EventTypeView = "view" )
const ( EventSubtypePurchase = "purchase" EventSubtypeAddToCart = "addToCart" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to interact with the Algolia Insights API.
func NewClient ¶
NewClient instantiates a new client able to interact with the Algolia Insights API.
func NewClientWithConfig ¶
func NewClientWithConfig(config Configuration) *Client
NewClientWithConfig instantiates a new client able to interact with the Algolia Insights API.
func (*Client) SendEvent ¶
func (c *Client) SendEvent(event Event, opts ...interface{}) (res StatusMessageRes, err error)
SendEvent sends a new raw event to the Algolia Insights API. This method should only be used to send a custom event to the API. To send more common and predefined events, please use methods from UserClient instead.
func (*Client) SendEvents ¶
func (c *Client) SendEvents(events []Event, opts ...interface{}) (res StatusMessageRes, err error)
SendEvents sends new raw events to the Algolia Insights API. This method should only be used to send custom events to the API. To send more common and predefined events, please use methods from UserClient instead.
func (*Client) User ¶
func (c *Client) User(userToken string) *UserClient
User instantiates a new client able to interact with the Algolia Insights API where all events will be sent with the userToken field preset according to the given userToken.
type ClientInterface ¶
type ClientInterface interface { User(userToken string) *UserClient SendEvent(event Event, opts ...interface{}) (res StatusMessageRes, err error) SendEvents(events []Event, opts ...interface{}) (res StatusMessageRes, err error) }
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 Insights API.
type Event ¶
type Event struct { EventName string `json:"eventName"` EventType string `json:"eventType"` EventSubtype string `json:"eventSubtype,omitempty"` Index string `json:"index"` ObjectIDs []string `json:"objectIDs,omitempty"` Positions []int `json:"positions,omitempty"` QueryID string `json:"queryID,omitempty"` UserToken string `json:"userToken"` AuthenticatedUserToken *string `json:"authenticatedUserToken"` Currency *string `json:"currency,omitempty"` ObjectData []ObjectData `json:"objectData,omitempty"` Timestamp time.Time `json:"-"` Filters []string `json:"filters,omitempty"` Value interface{} `json:"value,omitempty"` }
func (Event) MarshalJSON ¶
type ObjectData ¶ added in v3.31.4
type StatusMessageRes ¶
type UserClient ¶
func (*UserClient) ClickedFilters ¶
func (c *UserClient) ClickedFilters( eventName string, indexName string, filters []string, opts ...interface{}, ) (res StatusMessageRes, err error)
func (*UserClient) ClickedObjectIDs ¶
func (c *UserClient) ClickedObjectIDs( eventName string, indexName string, objectIDs []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ClickedObjectIDsAfterSearch ¶
func (c *UserClient) ClickedObjectIDsAfterSearch( eventName string, indexName string, objectIDs []string, positions []int, queryID string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedFilters ¶
func (c *UserClient) ConvertedFilters( eventName string, indexName string, filters []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedFiltersAddToCart ¶ added in v3.31.2
func (c *UserClient) ConvertedFiltersAddToCart( eventName string, indexName string, filters []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedFiltersPurchase ¶ added in v3.31.2
func (c *UserClient) ConvertedFiltersPurchase( eventName string, indexName string, filters []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedObjectIDs ¶
func (c *UserClient) ConvertedObjectIDs( eventName string, indexName string, objectIDs []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedObjectIDsAddToCart ¶ added in v3.31.2
func (c *UserClient) ConvertedObjectIDsAddToCart( eventName string, indexName string, objectIDs []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedObjectIDsAfterSearch ¶
func (c *UserClient) ConvertedObjectIDsAfterSearch( eventName string, indexName string, objectIDs []string, queryID string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedObjectIDsAfterSearchAddToCart ¶ added in v3.31.2
func (c *UserClient) ConvertedObjectIDsAfterSearchAddToCart( eventName string, indexName string, objectIDs []string, queryID string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedObjectIDsAfterSearchPurchase ¶ added in v3.31.2
func (c *UserClient) ConvertedObjectIDsAfterSearchPurchase( eventName string, indexName string, objectIDs []string, queryID string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ConvertedObjectIDsPurchase ¶ added in v3.31.2
func (c *UserClient) ConvertedObjectIDsPurchase( eventName string, indexName string, objectIDs []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ViewedFilters ¶
func (c *UserClient) ViewedFilters( eventName string, indexName string, filters []string, opts ...interface{}, ) (StatusMessageRes, error)
func (*UserClient) ViewedObjectIDs ¶
func (c *UserClient) ViewedObjectIDs( eventName string, indexName string, objectIDs []string, opts ...interface{}, ) (StatusMessageRes, error)
type UserClientInterface ¶
type UserClientInterface interface { ClickedObjectIDs(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error) ClickedObjectIDsAfterSearch(eventName string, indexName string, objectIDs []string, positions []int, queryID string, opts ...interface{}) (StatusMessageRes, error) ClickedFilters(eventName string, indexName string, filters []string, opts ...interface{}) (res StatusMessageRes, err error) ConvertedObjectIDs(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error) ConvertedObjectIDsAfterSearch(eventName string, indexName string, objectIDs []string, queryID string, opts ...interface{}) (StatusMessageRes, error) ConvertedFilters(eventName string, indexName string, filters []string, opts ...interface{}) (StatusMessageRes, error) ViewedObjectIDs(eventName string, indexName string, objectIDs []string, opts ...interface{}) (StatusMessageRes, error) ViewedFilters(eventName string, indexName string, filters []string, opts ...interface{}) (StatusMessageRes, error) }