analytics

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveAnalyticsFiltersJSON

func SaveAnalyticsFiltersJSON(items []AnalyticsFilters) ([]byte, error)

SaveAnalyticsFilters converts filters to JSON for storage

Types

type AnalyticsFilters

type AnalyticsFilters struct {
	GameId  string      `json:"gameId"`
	Filters interface{} `json:"filters"`
}

func LoadAnalyticsFilters

func LoadAnalyticsFilters(data []byte) ([]AnalyticsFilters, error)

LoadAnalyticsFilters reads the stored filters from a JSON file

type AnalyticsFiltersQuery

type AnalyticsFiltersQuery struct {
}

type AnalyticsQuery

type AnalyticsQuery struct {
	GameId    string `form:"gameId"`
	Env       string `form:"env"`
	StartDate string `form:"startDate"`
	EndDate   string `form:"endDate"`
}

type BehaviorAdoptionBreakdownRequest

type BehaviorAdoptionBreakdownRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	Feature   string `json:"feature" binding:"required"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type BehaviorAdoptionBreakdownResponse

type BehaviorAdoptionBreakdownResponse struct {
	BySegment map[string]interface{} `json:"bySegment"`
	ByTime    map[string]interface{} `json:"byTime"`
}

type BehaviorAdoptionRequest

type BehaviorAdoptionRequest struct {
	GameId  string `json:"gameId" binding:"required"`
	Env     string `json:"env"`
	Feature string `json:"feature"`
}

type BehaviorAdoptionResponse

type BehaviorAdoptionResponse struct {
	Features []FeatureAdoption `json:"features"`
}

type BehaviorEvent

type BehaviorEvent struct {
	EventType string      `json:"eventType"`
	UserId    string      `json:"userId"`
	Data      interface{} `json:"data"`
	Timestamp string      `json:"timestamp"`
}

type BehaviorEventsRequest

type BehaviorEventsRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	EventType string `json:"eventType"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
	Limit     int    `json:"limit"`
}

type BehaviorEventsResponse

type BehaviorEventsResponse struct {
	Items []BehaviorEvent `json:"items"`
	Total int             `json:"total"`
}

type BehaviorFunnelRequest

type BehaviorFunnelRequest struct {
	GameId    string   `json:"gameId" binding:"required"`
	Env       string   `json:"env"`
	StartDate string   `json:"startDate"`
	EndDate   string   `json:"endDate"`
	Steps     []string `json:"steps" binding:"required,min=1"`
}

type BehaviorFunnelResponse

type BehaviorFunnelResponse struct {
	Steps []FunnelStep `json:"steps"`
}

type BehaviorPathsRequest

type BehaviorPathsRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
	Depth     int    `json:"depth"`
}

type BehaviorPathsResponse

type BehaviorPathsResponse struct {
	Paths map[string]interface{} `json:"paths"`
}

type BehaviorRequest

type BehaviorRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type BehaviorResponse

type BehaviorResponse struct {
	TopActions []map[string]interface{} `json:"topActions"`
	UserFlows  map[string]interface{}   `json:"userFlows"`
	HeatMap    map[string]interface{}   `json:"heatMap"`
}

type EpisodeMetrics

type EpisodeMetrics struct {
	EpisodeId      string  `json:"episodeId"`
	Players        int     `json:"players"`
	CompletionRate float64 `json:"completionRate"`
	AvgProgress    float64 `json:"avgProgress"`
}

type FeatureAdoption

type FeatureAdoption struct {
	Feature      string  `json:"feature"`
	Users        int     `json:"users"`
	AdoptionRate float64 `json:"adoptionRate"`
	Frequency    float64 `json:"frequency"`
}

type FiltersGetRequest

type FiltersGetRequest struct {
	GameId string `json:"gameId"`
}

type FiltersGetResponse

type FiltersGetResponse struct {
	Items []AnalyticsFilters `json:"items"`
}

type FiltersUpdateRequest

type FiltersUpdateRequest struct {
	GameId  string      `json:"gameId" binding:"required"`
	Filters interface{} `json:"filters" binding:"required"`
}

type FunnelStep

type FunnelStep struct {
	Step           string  `json:"step"`
	Users          int     `json:"users"`
	ConversionRate float64 `json:"conversionRate"`
	DropOffRate    float64 `json:"dropOffRate"`
}

type Handler

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

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) Behavior

func (h *Handler) Behavior(c *gin.Context)

func (*Handler) BehaviorAdoption

func (h *Handler) BehaviorAdoption(c *gin.Context)

func (*Handler) BehaviorAdoptionBreakdown

func (h *Handler) BehaviorAdoptionBreakdown(c *gin.Context)

func (*Handler) BehaviorEvents

func (h *Handler) BehaviorEvents(c *gin.Context)

func (*Handler) BehaviorFunnel

func (h *Handler) BehaviorFunnel(c *gin.Context)

func (*Handler) BehaviorPaths

func (h *Handler) BehaviorPaths(c *gin.Context)

func (*Handler) FiltersGet

func (h *Handler) FiltersGet(c *gin.Context)

func (*Handler) FiltersUpdate

func (h *Handler) FiltersUpdate(c *gin.Context)

func (*Handler) Ingest

func (h *Handler) Ingest(c *gin.Context)

func (*Handler) Levels

func (h *Handler) Levels(c *gin.Context)

func (*Handler) LevelsEpisodes

func (h *Handler) LevelsEpisodes(c *gin.Context)

func (*Handler) LevelsMaps

func (h *Handler) LevelsMaps(c *gin.Context)

func (*Handler) Overview

func (h *Handler) Overview(c *gin.Context)

func (*Handler) Payments

func (h *Handler) Payments(c *gin.Context)

func (*Handler) PaymentsIngest

func (h *Handler) PaymentsIngest(c *gin.Context)

func (*Handler) PaymentsProductTrend

func (h *Handler) PaymentsProductTrend(c *gin.Context)

func (*Handler) PaymentsSummary

func (h *Handler) PaymentsSummary(c *gin.Context)

func (*Handler) PaymentsTransactions

func (h *Handler) PaymentsTransactions(c *gin.Context)

func (*Handler) Realtime

func (h *Handler) Realtime(c *gin.Context)

func (*Handler) RealtimeSeries

func (h *Handler) RealtimeSeries(c *gin.Context)

func (*Handler) Retention

func (h *Handler) Retention(c *gin.Context)

type IngestRequest

type IngestRequest struct {
	GameId    string      `json:"gameId" binding:"required"`
	Env       string      `json:"env"`
	Events    interface{} `json:"events" binding:"required"`
	Timestamp string      `json:"timestamp"`
}

type IngestResponse

type IngestResponse struct {
	Accepted int    `json:"accepted"`
	Rejected int    `json:"rejected"`
	BatchId  string `json:"batchId"`
}

type LevelMetrics

type LevelMetrics struct {
	LevelId        string  `json:"levelId"`
	Attempts       int     `json:"attempts"`
	Completions    int     `json:"completions"`
	CompletionRate float64 `json:"completionRate"`
	AvgDuration    float64 `json:"avgDuration"`
	AvgRetries     float64 `json:"avgRetries"`
}

type LevelsEpisodesRequest

type LevelsEpisodesRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type LevelsEpisodesResponse

type LevelsEpisodesResponse struct {
	Episodes []EpisodeMetrics `json:"episodes"`
}

type LevelsMapsRequest

type LevelsMapsRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type LevelsMapsResponse

type LevelsMapsResponse struct {
	Maps []MapMetrics `json:"maps"`
}

type LevelsRequest

type LevelsRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type LevelsResponse

type LevelsResponse struct {
	Levels []LevelMetrics `json:"levels"`
}

type MapMetrics

type MapMetrics struct {
	MapId      string      `json:"mapId"`
	HeatMap    interface{} `json:"heatMap"`
	DeathSpots interface{} `json:"deathSpots"`
}

type OverviewMetrics

type OverviewMetrics struct {
	DAU        int     `json:"dau"`
	MAU        int     `json:"mau"`
	NewUsers   int     `json:"newUsers"`
	Revenue    float64 `json:"revenue"`
	ARPU       float64 `json:"arpu"`
	ARPPU      float64 `json:"arppu"`
	PayingRate float64 `json:"payingRate"`
}

type OverviewRequest

type OverviewRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type OverviewResponse

type OverviewResponse struct {
	Metrics OverviewMetrics        `json:"metrics"`
	Trends  map[string]interface{} `json:"trends"`
}

type PaymentTransaction

type PaymentTransaction struct {
	Id            string  `json:"id"`
	UserId        string  `json:"userId"`
	ProductId     string  `json:"productId"`
	Amount        float64 `json:"amount"`
	Currency      string  `json:"currency"`
	Status        string  `json:"status"`
	PaymentMethod string  `json:"paymentMethod"`
	CreatedAt     string  `json:"createdAt"`
}

type PaymentsIngestRequest

type PaymentsIngestRequest struct {
	GameId       string      `json:"gameId" binding:"required"`
	Env          string      `json:"env"`
	Transactions interface{} `json:"transactions" binding:"required"`
}

type PaymentsIngestResponse

type PaymentsIngestResponse struct {
	Accepted int    `json:"accepted"`
	Rejected int    `json:"rejected"`
	BatchId  string `json:"batchId"`
}

type PaymentsMetrics

type PaymentsMetrics struct {
	Revenue        float64 `json:"revenue"`
	Transactions   int     `json:"transactions"`
	PayingUsers    int     `json:"payingUsers"`
	ARPU           float64 `json:"arpu"`
	ARPPU          float64 `json:"arppu"`
	ConversionRate float64 `json:"conversionRate"`
}

type PaymentsProductTrendRequest

type PaymentsProductTrendRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
	Limit     int    `json:"limit"`
}

type PaymentsProductTrendResponse

type PaymentsProductTrendResponse struct {
	Items []ProductTrend `json:"items"`
}

type PaymentsRequest

type PaymentsRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type PaymentsResponse

type PaymentsResponse struct {
	Metrics PaymentsMetrics        `json:"metrics"`
	Trends  map[string]interface{} `json:"trends"`
}

type PaymentsSummary

type PaymentsSummary struct {
	Date         string  `json:"date"`
	Revenue      float64 `json:"revenue"`
	Transactions int     `json:"transactions"`
	Users        int     `json:"users"`
}

type PaymentsSummaryRequest

type PaymentsSummaryRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
	GroupBy   string `json:"groupBy"`
}

type PaymentsSummaryResponse

type PaymentsSummaryResponse struct {
	Items []PaymentsSummary `json:"items"`
}

type PaymentsTransactionsRequest

type PaymentsTransactionsRequest struct {
	Page      int    `json:"page"`
	PageSize  int    `json:"pageSize"`
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	Status    string `json:"status"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type PaymentsTransactionsResponse

type PaymentsTransactionsResponse struct {
	Items []PaymentTransaction `json:"items"`
	Total int                  `json:"total"`
	Page  int                  `json:"page"`
	Size  int                  `json:"size"`
}

type ProductTrend

type ProductTrend struct {
	ProductId   string  `json:"productId"`
	ProductName string  `json:"productName"`
	Revenue     float64 `json:"revenue"`
	Sales       int     `json:"sales"`
	Growth      float64 `json:"growth"`
}

type RealtimeMetrics

type RealtimeMetrics struct {
	OnlineUsers    int         `json:"onlineUsers"`
	ActiveSessions int         `json:"activeSessions"`
	QPS            float64     `json:"qps"`
	AvgLatency     float64     `json:"avgLatency"`
	ErrorRate      float64     `json:"errorRate"`
	TopEvents      interface{} `json:"topEvents"`
}

type RealtimeRequest

type RealtimeRequest struct {
	GameId string `json:"gameId" binding:"required"`
	Env    string `json:"env"`
}

type RealtimeResponse

type RealtimeResponse struct {
	RealtimeMetrics RealtimeMetrics `json:"realtimeMetrics"`
	Timestamp       string          `json:"timestamp"`
}

type RealtimeSeriesRequest

type RealtimeSeriesRequest struct {
	GameId   string `json:"gameId" binding:"required"`
	Env      string `json:"env"`
	Interval string `json:"interval"`
	Duration int    `json:"duration"`
}

type RealtimeSeriesResponse

type RealtimeSeriesResponse struct {
	Series map[string]interface{} `json:"series"`
}

type RetentionCohort

type RetentionCohort struct {
	Cohort    string    `json:"cohort"`
	Users     int       `json:"users"`
	Retention []float64 `json:"retention"`
}

type RetentionRequest

type RetentionRequest struct {
	GameId    string `json:"gameId" binding:"required"`
	Env       string `json:"env"`
	Cohort    string `json:"cohort"`
	StartDate string `json:"startDate"`
	EndDate   string `json:"endDate"`
}

type RetentionResponse

type RetentionResponse struct {
	Cohorts []RetentionCohort `json:"cohorts"`
}

type Service

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

func NewService

func NewService(svcCtx *svc.ServiceContext) *Service

func (*Service) Behavior

func (s *Service) Behavior(ctx context.Context, req *BehaviorRequest) (*BehaviorResponse, error)

func (*Service) BehaviorAdoption

func (s *Service) BehaviorAdoption(ctx context.Context, req *BehaviorAdoptionRequest) (*BehaviorAdoptionResponse, error)

func (*Service) BehaviorEvents

func (s *Service) BehaviorEvents(ctx context.Context, req *BehaviorEventsRequest) (*BehaviorEventsResponse, error)

func (*Service) BehaviorFunnel

func (s *Service) BehaviorFunnel(ctx context.Context, req *BehaviorFunnelRequest) (*BehaviorFunnelResponse, error)

func (*Service) BehaviorPaths

func (s *Service) BehaviorPaths(ctx context.Context, req *BehaviorPathsRequest) (*BehaviorPathsResponse, error)

func (*Service) FiltersGet

func (s *Service) FiltersGet(ctx context.Context, req *FiltersGetRequest) (*FiltersGetResponse, error)

func (*Service) FiltersUpdate

func (s *Service) FiltersUpdate(ctx context.Context, req *FiltersUpdateRequest) (*FiltersGetResponse, error)

func (*Service) Ingest

func (s *Service) Ingest(ctx context.Context, req *IngestRequest) (*IngestResponse, error)

func (*Service) Levels

func (s *Service) Levels(ctx context.Context, req *LevelsRequest) (*LevelsResponse, error)

func (*Service) LevelsEpisodes

func (s *Service) LevelsEpisodes(ctx context.Context, req *LevelsEpisodesRequest) (*LevelsEpisodesResponse, error)

func (*Service) LevelsMaps

func (s *Service) LevelsMaps(ctx context.Context, req *LevelsMapsRequest) (*LevelsMapsResponse, error)

func (*Service) Overview

func (s *Service) Overview(ctx context.Context, req *OverviewRequest) (*OverviewResponse, error)

func (*Service) Payments

func (s *Service) Payments(ctx context.Context, req *PaymentsRequest) (*PaymentsResponse, error)

func (*Service) PaymentsIngest

func (s *Service) PaymentsIngest(ctx context.Context, req *PaymentsIngestRequest) (*PaymentsIngestResponse, error)

func (*Service) PaymentsProductTrend

func (*Service) PaymentsSummary

func (s *Service) PaymentsSummary(ctx context.Context, req *PaymentsSummaryRequest) (*PaymentsSummaryResponse, error)

func (*Service) PaymentsTransactions

func (*Service) Realtime

func (s *Service) Realtime(ctx context.Context, req *RealtimeRequest) (*RealtimeResponse, error)

func (*Service) RealtimeSeries

func (s *Service) RealtimeSeries(ctx context.Context, req *RealtimeSeriesRequest) (*RealtimeSeriesResponse, error)

func (*Service) Retention

func (s *Service) Retention(ctx context.Context, req *RetentionRequest) (*RetentionResponse, error)

Jump to

Keyboard shortcuts

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