Documentation
¶
Overview ¶
Package rts implements Real Time Statistics calculations module
Index ¶
- Constants
- func APIGetBestsellers(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetConversion(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetSales(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetSalesDetails(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetVisits(context api.InterfaceApplicationContext) (interface{}, error)
- func APIGetVisitsDetails(context api.InterfaceApplicationContext) (interface{}, error)
- func APIRegisterVisit(context api.InterfaceApplicationContext) (interface{}, error)
- func CheckHourUpdateForStatistic()
- func GetDateFrom() (time.Time, error)
- func SaveStatisticsData() error
- type ActionsMade
- type SellerInfo
Constants ¶
const ( ConstCollectionNameRTSSalesHistory = "rts_sales_history" ConstCollectionNameRTSVisitors = "rts_visitors" ConstReferrerTypeDirect = 0 ConstReferrerTypeSite = 1 ConstReferrerTypeSearch = 2 ConstVisitorOnlineSeconds = 10 ConstTimeDay = time.Hour * 24 ConstErrorModule = "rts" ConstErrorLevel = env.ConstErrorLevelActor ConstConfigPathCheckoutPath = "general.app.checkout_path" )
Package global constants
Variables ¶
This section is empty.
Functions ¶
func APIGetBestsellers ¶
func APIGetBestsellers(context api.InterfaceApplicationContext) (interface{}, error)
APIGetBestsellers returns information about bestsellers for some period
possible periods: "today", "yesterday", "week", "month"
func APIGetConversion ¶
func APIGetConversion(context api.InterfaceApplicationContext) (interface{}, error)
APIGetConversion returns site conversion information
func APIGetSales ¶
func APIGetSales(context api.InterfaceApplicationContext) (interface{}, error)
APIGetSales returns information about sales in the recent period, taking into account time zone
func APIGetSalesDetails ¶
func APIGetSalesDetails(context api.InterfaceApplicationContext) (interface{}, error)
APIGetSalesDetails returns site sales information for a specified period
- period start and end dates should be specified in "from" and "to" attributes in DD-MM-YYY format
func APIGetVisits ¶
func APIGetVisits(context api.InterfaceApplicationContext) (interface{}, error)
APIGetVisits returns site visit information for a specified local day
func APIGetVisitsDetails ¶
func APIGetVisitsDetails(context api.InterfaceApplicationContext) (interface{}, error)
APIGetVisitsDetails returns detailed site visit information for a specified period
- period start and end dates should be specified in "from" and "to" attributes in YYYY-MM-DD format
func APIRegisterVisit ¶
func APIRegisterVisit(context api.InterfaceApplicationContext) (interface{}, error)
APIRegisterVisit registers request for a statistics
func CheckHourUpdateForStatistic ¶
func CheckHourUpdateForStatistic()
CheckHourUpdateForStatistic if it's a new hour action we need renew all session as a new in this hour and remove old record from statistic
func GetDateFrom ¶
GetDateFrom returns the a time.Time of last record of sales history
func SaveStatisticsData ¶
func SaveStatisticsData() error
SaveStatisticsData save a statistic data row for last hour to database
Types ¶
type ActionsMade ¶
type ActionsMade struct { Visit int // count site visits Cart int // count times products was added to cart Sales int // count of orders visitors made TotalVisits int // total visits count SalesAmount float64 // count sales VisitCheckout int // count visitors reached checkout SetPayment int // count payment methods used }
ActionsMade contains info of visits, cart create and sales made for a hour
func GetRangeStats ¶
func GetRangeStats(dateFrom, dateTo time.Time) (ActionsMade, error)
GetRangeStats returns stats for range
type SellerInfo ¶
type SellerInfo struct { Name string // product name Image string // product image Count int // times bought }
SellerInfo represents particular product in TopSellers struct