Documentation
¶
Overview ¶
Package api implements an analytics API interface for interacting with the Google Analytics Account and Filter APIs.
Index ¶
- type API
- func (api *API) CreateFilter(accountID string, filterParameters Filter) (Filter, error)
- func (api *API) GetAccounts() ([]Account, error)
- func (api *API) GetAnalyticsData(accountID string, numberOfDays int) (AnalyticsData, error)
- func (api *API) GetFilters(accountID string) ([]Filter, error)
- func (api *API) GetProfiles(accountID string) ([]Profile, error)
- func (api *API) RemoveFilter(accountID, filterID string) error
- func (api *API) UpdateFilter(accountID string, filterID string, filterParameters Filter) (Filter, error)
- type Account
- type AnalyticsAPI
- type AnalyticsData
- type AnalyticsDataRow
- type Filter
- type FilterDetail
- type Profile
- type SortAccountsBy
- type SortFiltersBy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API provides CRUD operations for the Google Analytics API.
func (*API) CreateFilter ¶
CreateFilter creates a new Filter for the given account ID.
func (*API) GetAccounts ¶
GetAccounts returns all apiservice.Account models.
func (*API) GetAnalyticsData ¶ added in v0.3.0
func (api *API) GetAnalyticsData(accountID string, numberOfDays int) (AnalyticsData, error)
GetAnalyticsData analytics data for the given account ID.
func (*API) GetFilters ¶
GetFilters returns all Filter models for the given account.
func (*API) GetProfiles ¶
GetProfiles returns all Profile models for the given account.
func (*API) RemoveFilter ¶
RemoveFilter deletes the given filter from the specified account.
type AnalyticsAPI ¶
type AnalyticsAPI interface { // GetAccounts returns all apiservice.Account models. GetAccounts() ([]Account, error) // GetAnalyticsData analytics data for the given account ID. GetAnalyticsData(accountID string, numberOfDays int) (AnalyticsData, error) // CreateFilter creates a new Filter for the given account ID. CreateFilter(accountID string, filter Filter) (Filter, error) // UpdateFilter updates the given filter. UpdateFilter(accountID string, filterID string, filter Filter) (Filter, error) // GetFilters returns all Filter models for the given account. GetFilters(accountID string) ([]Filter, error) // GetProfiles returns all Profile models for the given account. GetProfiles(accountID string) ([]Profile, error) // RemoveFilter deletes the given filter from the specified account. RemoveFilter(accountID, filterID string) error }
The AnalyticsAPI interface provides Analytics API functions.
func New ¶
func New(tokenStore apicredentials.TokenStorer, clientID, clientSecret string) (AnalyticsAPI, error)
New creates a new API instance.
type AnalyticsData ¶ added in v0.3.0
type AnalyticsData []AnalyticsDataRow
AnalyticsData is a set of analytics data entries.
type AnalyticsDataRow ¶ added in v0.3.0
type AnalyticsDataRow struct { // Dimensions UserType string FullReferrer string Source string Medium string NetworkDomain string NetworkLocation string LandingPagePath string // Metrics Sessions int64 BounceRate float64 PageviewsPerSession float64 TimeOnPage float64 }
AnalyticsDataRow contains a single analytics data record.
type Filter ¶
type Filter struct { AccountID string ID string Kind string Name string Type string Link string ExcludeDetails FilterDetail }
A Filter contains information about Google Analtics view filters.
type FilterDetail ¶
type FilterDetail struct { Kind string Field string MatchType string ExpressionValue string CaseSensitive bool }
A FilterDetail contains the filter type and the expression of a Filter model.
func (FilterDetail) Equals ¶
func (details FilterDetail) Equals(other FilterDetail) bool
Equals checks the this FilterDetail matches the given one.
type Profile ¶
type Profile struct { ID string Kind string Link string AccountID string WebPropertyID string InternalWebPropertyID string Name string Currency string Timezone string WebsiteURL string Type string }
A Profile contains information about Google Analytics views.
type SortAccountsBy ¶
SortAccountsBy sorts two Account models.
func (SortAccountsBy) Sort ¶
func (by SortAccountsBy) Sort(accounts []Account)
Sort a slice of Account models.
type SortFiltersBy ¶
SortFiltersBy allows to sort Filter models.
func (SortFiltersBy) Sort ¶
func (by SortFiltersBy) Sort(filters []Filter)
Sort a slice of Filter models.
Directories
¶
Path | Synopsis |
---|---|
Package apicredentials contains the TokenStorer interface that is used as the oAuth token provider for the Google Analytics API.
|
Package apicredentials contains the TokenStorer interface that is used as the oAuth token provider for the Google Analytics API. |
Package apiservice implements a Google Analytics API client for the Google Analytics Acccount and Filter APIs.
|
Package apiservice implements a Google Analytics API client for the Google Analytics Acccount and Filter APIs. |