api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregate

type Aggregate struct {
	Visitors      int
	Visits        int
	Pageviews     int
	ViewsPerVisit float64
	BounceRate    float64
	VisitDuration int
}

type Client

type Client struct {
	BaseURL    string
	SiteID     string
	Token      string
	HTTPClient *http.Client
}

func NewClient

func NewClient(baseURL, siteID, token string) *Client

func (*Client) GetAggregate

func (c *Client) GetAggregate(dateRange any) (Aggregate, error)

func (*Client) GetRealtimeVisitors

func (c *Client) GetRealtimeVisitors() (int, error)

func (*Client) GetTimeSeries

func (c *Client) GetTimeSeries(dateRange any, timeDimension string) ([]TimeSeriesPoint, error)

func (*Client) GetTopPages

func (c *Client) GetTopPages(dateRange any, limit int) ([]PageStats, error)

func (*Client) GetTopSources

func (c *Client) GetTopSources(dateRange any, limit int) ([]SourceStats, error)

type PageStats

type PageStats struct {
	Page     string
	Visitors int
}

type Paginate

type Paginate struct {
	Limit  int `json:"limit,omitempty"`
	Offset int `json:"offset,omitempty"`
}

type Query

type Query struct {
	SiteID     string    `json:"site_id"`
	Metrics    []string  `json:"metrics"`
	DateRange  any       `json:"date_range"`
	Dimensions []string  `json:"dimensions,omitempty"`
	Filters    []any     `json:"filters,omitempty"`
	OrderBy    [][]any   `json:"order_by,omitempty"`
	Pagination *Paginate `json:"pagination,omitempty"`
}

type QueryResponse

type QueryResponse struct {
	Results []ResultRow `json:"results"`
}

type ResultRow

type ResultRow struct {
	Dimensions []string  `json:"dimensions"`
	Metrics    []float64 `json:"metrics"`
}

type SourceStats

type SourceStats struct {
	Source   string
	Visitors int
}

type TimeSeriesPoint

type TimeSeriesPoint struct {
	Date     string
	Visitors int
}

Jump to

Keyboard shortcuts

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