analytics
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package analytics provides access to the Google Analytics API.
For product documentation, see:https://developers.google.com/analytics/
Creating a client¶
Usage example:
import "google.golang.org/api/analytics/v2.4"...ctx := context.Background()analyticsService, err := analytics.NewService(ctx)
In this example, Google Application Default Credentials are used for authentication.
For information on how to create and obtain Application Default Credentials, seehttps://developers.google.com/identity/protocols/application-default-credentials.
Other authentication options¶
By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
analyticsService, err := analytics.NewService(ctx, option.WithScopes(analytics.AnalyticsReadonlyScope))
To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
analyticsService, err := analytics.NewService(ctx, option.WithAPIKey("AIza..."))To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
config := &oauth2.Config{...}// ...token, err := config.Exchange(ctx, ...)analyticsService, err := analytics.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))Seehttps://godoc.org/google.golang.org/api/option/ for details on options.
Index¶
- Constants
- type DataGetCall
- func (c *DataGetCall) Context(ctx context.Context) *DataGetCall
- func (c *DataGetCall) Dimensions(dimensions string) *DataGetCall
- func (c *DataGetCall) Do(opts ...googleapi.CallOption) error
- func (c *DataGetCall) Fields(s ...googleapi.Field) *DataGetCall
- func (c *DataGetCall) Filters(filters string) *DataGetCall
- func (c *DataGetCall) Header() http.Header
- func (c *DataGetCall) IfNoneMatch(entityTag string) *DataGetCall
- func (c *DataGetCall) MaxResults(maxResults int64) *DataGetCall
- func (c *DataGetCall) Segment(segment string) *DataGetCall
- func (c *DataGetCall) Sort(sort string) *DataGetCall
- func (c *DataGetCall) StartIndex(startIndex int64) *DataGetCall
- type DataService
- type ManagementAccountsListCall
- func (c *ManagementAccountsListCall) Context(ctx context.Context) *ManagementAccountsListCall
- func (c *ManagementAccountsListCall) Do(opts ...googleapi.CallOption) error
- func (c *ManagementAccountsListCall) Fields(s ...googleapi.Field) *ManagementAccountsListCall
- func (c *ManagementAccountsListCall) Header() http.Header
- func (c *ManagementAccountsListCall) IfNoneMatch(entityTag string) *ManagementAccountsListCall
- func (c *ManagementAccountsListCall) MaxResults(maxResults int64) *ManagementAccountsListCall
- func (c *ManagementAccountsListCall) StartIndex(startIndex int64) *ManagementAccountsListCall
- type ManagementAccountsService
- type ManagementGoalsListCall
- func (c *ManagementGoalsListCall) Context(ctx context.Context) *ManagementGoalsListCall
- func (c *ManagementGoalsListCall) Do(opts ...googleapi.CallOption) error
- func (c *ManagementGoalsListCall) Fields(s ...googleapi.Field) *ManagementGoalsListCall
- func (c *ManagementGoalsListCall) Header() http.Header
- func (c *ManagementGoalsListCall) IfNoneMatch(entityTag string) *ManagementGoalsListCall
- func (c *ManagementGoalsListCall) MaxResults(maxResults int64) *ManagementGoalsListCall
- func (c *ManagementGoalsListCall) StartIndex(startIndex int64) *ManagementGoalsListCall
- type ManagementGoalsService
- type ManagementProfilesListCall
- func (c *ManagementProfilesListCall) Context(ctx context.Context) *ManagementProfilesListCall
- func (c *ManagementProfilesListCall) Do(opts ...googleapi.CallOption) error
- func (c *ManagementProfilesListCall) Fields(s ...googleapi.Field) *ManagementProfilesListCall
- func (c *ManagementProfilesListCall) Header() http.Header
- func (c *ManagementProfilesListCall) IfNoneMatch(entityTag string) *ManagementProfilesListCall
- func (c *ManagementProfilesListCall) MaxResults(maxResults int64) *ManagementProfilesListCall
- func (c *ManagementProfilesListCall) StartIndex(startIndex int64) *ManagementProfilesListCall
- type ManagementProfilesService
- type ManagementSegmentsListCall
- func (c *ManagementSegmentsListCall) Context(ctx context.Context) *ManagementSegmentsListCall
- func (c *ManagementSegmentsListCall) Do(opts ...googleapi.CallOption) error
- func (c *ManagementSegmentsListCall) Fields(s ...googleapi.Field) *ManagementSegmentsListCall
- func (c *ManagementSegmentsListCall) Header() http.Header
- func (c *ManagementSegmentsListCall) IfNoneMatch(entityTag string) *ManagementSegmentsListCall
- func (c *ManagementSegmentsListCall) MaxResults(maxResults int64) *ManagementSegmentsListCall
- func (c *ManagementSegmentsListCall) StartIndex(startIndex int64) *ManagementSegmentsListCall
- type ManagementSegmentsService
- type ManagementService
- type ManagementWebpropertiesListCall
- func (c *ManagementWebpropertiesListCall) Context(ctx context.Context) *ManagementWebpropertiesListCall
- func (c *ManagementWebpropertiesListCall) Do(opts ...googleapi.CallOption) error
- func (c *ManagementWebpropertiesListCall) Fields(s ...googleapi.Field) *ManagementWebpropertiesListCall
- func (c *ManagementWebpropertiesListCall) Header() http.Header
- func (c *ManagementWebpropertiesListCall) IfNoneMatch(entityTag string) *ManagementWebpropertiesListCall
- func (c *ManagementWebpropertiesListCall) MaxResults(maxResults int64) *ManagementWebpropertiesListCall
- func (c *ManagementWebpropertiesListCall) StartIndex(startIndex int64) *ManagementWebpropertiesListCall
- type ManagementWebpropertiesService
- type Service
Constants¶
const (// View and manage your Google Analytics dataAnalyticsScope = "https://www.googleapis.com/auth/analytics"// View your Google Analytics dataAnalyticsReadonlyScope = "https://www.googleapis.com/auth/analytics.readonly")
OAuth2 scopes used by this API.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeDataGetCall¶
type DataGetCall struct {// contains filtered or unexported fields}func (*DataGetCall)Context¶
func (c *DataGetCall) Context(ctxcontext.Context) *DataGetCall
Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.
func (*DataGetCall)Dimensions¶
func (c *DataGetCall) Dimensions(dimensionsstring) *DataGetCall
Dimensions sets the optional parameter "dimensions": Acomma-separated list of Analytics dimensions. E.g.,'ga:browser,ga:city'.
func (*DataGetCall)Do¶
func (c *DataGetCall) Do(opts ...googleapi.CallOption)error
Do executes the "analytics.data.get" call.
func (*DataGetCall)Fields¶
func (c *DataGetCall) Fields(s ...googleapi.Field) *DataGetCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.
func (*DataGetCall)Filters¶
func (c *DataGetCall) Filters(filtersstring) *DataGetCall
Filters sets the optional parameter "filters": A comma-separated listof dimension or metric filters to be applied to the report data.
func (*DataGetCall)Header¶
func (c *DataGetCall) Header()http.Header
Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.
func (*DataGetCall)IfNoneMatch¶
func (c *DataGetCall) IfNoneMatch(entityTagstring) *DataGetCall
IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.
func (*DataGetCall)MaxResults¶
func (c *DataGetCall) MaxResults(maxResultsint64) *DataGetCall
MaxResults sets the optional parameter "max-results": The maximumnumber of entries to include in this feed.
func (*DataGetCall)Segment¶
func (c *DataGetCall) Segment(segmentstring) *DataGetCall
Segment sets the optional parameter "segment": An Analytics advancedsegment to be applied to the report data.
func (*DataGetCall)Sort¶
func (c *DataGetCall) Sort(sortstring) *DataGetCall
Sort sets the optional parameter "sort": A comma-separated list ofdimensions or metrics that determine the sort order for the reportdata.
func (*DataGetCall)StartIndex¶
func (c *DataGetCall) StartIndex(startIndexint64) *DataGetCall
StartIndex sets the optional parameter "start-index": An index of thefirst entity to retrieve. Use this parameter as a paginationmechanism along with the max-results parameter.
typeDataService¶
type DataService struct {// contains filtered or unexported fields}funcNewDataService¶
func NewDataService(s *Service) *DataService
func (*DataService)Get¶
func (r *DataService) Get(idsstring, startDatestring, endDatestring, metricsstring) *DataGetCall
Get: Returns Analytics report data for a view (profile).
typeManagementAccountsListCall¶
type ManagementAccountsListCall struct {// contains filtered or unexported fields}func (*ManagementAccountsListCall)Context¶
func (c *ManagementAccountsListCall) Context(ctxcontext.Context) *ManagementAccountsListCall
Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.
func (*ManagementAccountsListCall)Do¶
func (c *ManagementAccountsListCall) Do(opts ...googleapi.CallOption)error
Do executes the "analytics.management.accounts.list" call.
func (*ManagementAccountsListCall)Fields¶
func (c *ManagementAccountsListCall) Fields(s ...googleapi.Field) *ManagementAccountsListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.
func (*ManagementAccountsListCall)Header¶
func (c *ManagementAccountsListCall) Header()http.Header
Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.
func (*ManagementAccountsListCall)IfNoneMatch¶
func (c *ManagementAccountsListCall) IfNoneMatch(entityTagstring) *ManagementAccountsListCall
IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.
func (*ManagementAccountsListCall)MaxResults¶
func (c *ManagementAccountsListCall) MaxResults(maxResultsint64) *ManagementAccountsListCall
MaxResults sets the optional parameter "max-results": The maximumnumber of accounts to include in this response.
func (*ManagementAccountsListCall)StartIndex¶
func (c *ManagementAccountsListCall) StartIndex(startIndexint64) *ManagementAccountsListCall
StartIndex sets the optional parameter "start-index": An index of thefirst account to retrieve. Use this parameter as a paginationmechanism along with the max-results parameter.
typeManagementAccountsService¶
type ManagementAccountsService struct {// contains filtered or unexported fields}funcNewManagementAccountsService¶
func NewManagementAccountsService(s *Service) *ManagementAccountsService
func (*ManagementAccountsService)List¶
func (r *ManagementAccountsService) List() *ManagementAccountsListCall
List: Lists all accounts to which the user has access.
typeManagementGoalsListCall¶
type ManagementGoalsListCall struct {// contains filtered or unexported fields}func (*ManagementGoalsListCall)Context¶
func (c *ManagementGoalsListCall) Context(ctxcontext.Context) *ManagementGoalsListCall
Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.
func (*ManagementGoalsListCall)Do¶
func (c *ManagementGoalsListCall) Do(opts ...googleapi.CallOption)error
Do executes the "analytics.management.goals.list" call.
func (*ManagementGoalsListCall)Fields¶
func (c *ManagementGoalsListCall) Fields(s ...googleapi.Field) *ManagementGoalsListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.
func (*ManagementGoalsListCall)Header¶
func (c *ManagementGoalsListCall) Header()http.Header
Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.
func (*ManagementGoalsListCall)IfNoneMatch¶
func (c *ManagementGoalsListCall) IfNoneMatch(entityTagstring) *ManagementGoalsListCall
IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.
func (*ManagementGoalsListCall)MaxResults¶
func (c *ManagementGoalsListCall) MaxResults(maxResultsint64) *ManagementGoalsListCall
MaxResults sets the optional parameter "max-results": The maximumnumber of goals to include in this response.
func (*ManagementGoalsListCall)StartIndex¶
func (c *ManagementGoalsListCall) StartIndex(startIndexint64) *ManagementGoalsListCall
StartIndex sets the optional parameter "start-index": An index of thefirst goal to retrieve. Use this parameter as a pagination mechanismalong with the max-results parameter.
typeManagementGoalsService¶
type ManagementGoalsService struct {// contains filtered or unexported fields}funcNewManagementGoalsService¶
func NewManagementGoalsService(s *Service) *ManagementGoalsService
func (*ManagementGoalsService)List¶
func (r *ManagementGoalsService) List(accountIdstring, webPropertyIdstring, profileIdstring) *ManagementGoalsListCall
List: Lists goals to which the user has access.
typeManagementProfilesListCall¶
type ManagementProfilesListCall struct {// contains filtered or unexported fields}func (*ManagementProfilesListCall)Context¶
func (c *ManagementProfilesListCall) Context(ctxcontext.Context) *ManagementProfilesListCall
Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.
func (*ManagementProfilesListCall)Do¶
func (c *ManagementProfilesListCall) Do(opts ...googleapi.CallOption)error
Do executes the "analytics.management.profiles.list" call.
func (*ManagementProfilesListCall)Fields¶
func (c *ManagementProfilesListCall) Fields(s ...googleapi.Field) *ManagementProfilesListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.
func (*ManagementProfilesListCall)Header¶
func (c *ManagementProfilesListCall) Header()http.Header
Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.
func (*ManagementProfilesListCall)IfNoneMatch¶
func (c *ManagementProfilesListCall) IfNoneMatch(entityTagstring) *ManagementProfilesListCall
IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.
func (*ManagementProfilesListCall)MaxResults¶
func (c *ManagementProfilesListCall) MaxResults(maxResultsint64) *ManagementProfilesListCall
MaxResults sets the optional parameter "max-results": The maximumnumber of views (profiles) to include in this response.
func (*ManagementProfilesListCall)StartIndex¶
func (c *ManagementProfilesListCall) StartIndex(startIndexint64) *ManagementProfilesListCall
StartIndex sets the optional parameter "start-index": An index of thefirst entity to retrieve. Use this parameter as a paginationmechanism along with the max-results parameter.
typeManagementProfilesService¶
type ManagementProfilesService struct {// contains filtered or unexported fields}funcNewManagementProfilesService¶
func NewManagementProfilesService(s *Service) *ManagementProfilesService
func (*ManagementProfilesService)List¶
func (r *ManagementProfilesService) List(accountIdstring, webPropertyIdstring) *ManagementProfilesListCall
List: Lists views (profiles) to which the user has access.
typeManagementSegmentsListCall¶
type ManagementSegmentsListCall struct {// contains filtered or unexported fields}func (*ManagementSegmentsListCall)Context¶
func (c *ManagementSegmentsListCall) Context(ctxcontext.Context) *ManagementSegmentsListCall
Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.
func (*ManagementSegmentsListCall)Do¶
func (c *ManagementSegmentsListCall) Do(opts ...googleapi.CallOption)error
Do executes the "analytics.management.segments.list" call.
func (*ManagementSegmentsListCall)Fields¶
func (c *ManagementSegmentsListCall) Fields(s ...googleapi.Field) *ManagementSegmentsListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.
func (*ManagementSegmentsListCall)Header¶
func (c *ManagementSegmentsListCall) Header()http.Header
Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.
func (*ManagementSegmentsListCall)IfNoneMatch¶
func (c *ManagementSegmentsListCall) IfNoneMatch(entityTagstring) *ManagementSegmentsListCall
IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.
func (*ManagementSegmentsListCall)MaxResults¶
func (c *ManagementSegmentsListCall) MaxResults(maxResultsint64) *ManagementSegmentsListCall
MaxResults sets the optional parameter "max-results": The maximumnumber of advanced segments to include in this response.
func (*ManagementSegmentsListCall)StartIndex¶
func (c *ManagementSegmentsListCall) StartIndex(startIndexint64) *ManagementSegmentsListCall
StartIndex sets the optional parameter "start-index": An index of thefirst advanced segment to retrieve. Use this parameter as apagination mechanism along with the max-results parameter.
typeManagementSegmentsService¶
type ManagementSegmentsService struct {// contains filtered or unexported fields}funcNewManagementSegmentsService¶
func NewManagementSegmentsService(s *Service) *ManagementSegmentsService
func (*ManagementSegmentsService)List¶
func (r *ManagementSegmentsService) List() *ManagementSegmentsListCall
List: Lists advanced segments to which the user has access.
typeManagementService¶
type ManagementService struct {Accounts *ManagementAccountsServiceGoals *ManagementGoalsServiceProfiles *ManagementProfilesServiceSegments *ManagementSegmentsServiceWebproperties *ManagementWebpropertiesService// contains filtered or unexported fields}funcNewManagementService¶
func NewManagementService(s *Service) *ManagementService
typeManagementWebpropertiesListCall¶
type ManagementWebpropertiesListCall struct {// contains filtered or unexported fields}func (*ManagementWebpropertiesListCall)Context¶
func (c *ManagementWebpropertiesListCall) Context(ctxcontext.Context) *ManagementWebpropertiesListCall
Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.
func (*ManagementWebpropertiesListCall)Do¶
func (c *ManagementWebpropertiesListCall) Do(opts ...googleapi.CallOption)error
Do executes the "analytics.management.webproperties.list" call.
func (*ManagementWebpropertiesListCall)Fields¶
func (c *ManagementWebpropertiesListCall) Fields(s ...googleapi.Field) *ManagementWebpropertiesListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.
func (*ManagementWebpropertiesListCall)Header¶
func (c *ManagementWebpropertiesListCall) Header()http.Header
Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.
func (*ManagementWebpropertiesListCall)IfNoneMatch¶
func (c *ManagementWebpropertiesListCall) IfNoneMatch(entityTagstring) *ManagementWebpropertiesListCall
IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.
func (*ManagementWebpropertiesListCall)MaxResults¶
func (c *ManagementWebpropertiesListCall) MaxResults(maxResultsint64) *ManagementWebpropertiesListCall
MaxResults sets the optional parameter "max-results": The maximumnumber of web properties to include in this response.
func (*ManagementWebpropertiesListCall)StartIndex¶
func (c *ManagementWebpropertiesListCall) StartIndex(startIndexint64) *ManagementWebpropertiesListCall
StartIndex sets the optional parameter "start-index": An index of thefirst entity to retrieve. Use this parameter as a paginationmechanism along with the max-results parameter.
typeManagementWebpropertiesService¶
type ManagementWebpropertiesService struct {// contains filtered or unexported fields}funcNewManagementWebpropertiesService¶
func NewManagementWebpropertiesService(s *Service) *ManagementWebpropertiesService
func (*ManagementWebpropertiesService)List¶
func (r *ManagementWebpropertiesService) List(accountIdstring) *ManagementWebpropertiesListCall
List: Lists web properties to which the user has access.
typeService¶
type Service struct {BasePathstring// API endpoint base URLUserAgentstring// optional additional User-Agent fragmentData *DataServiceManagement *ManagementService// contains filtered or unexported fields} funcNewdeprecated
New creates a new Service. It uses the provided http.Client for requests.
Deprecated: please use NewService instead.To provide a custom HTTP client, use option.WithHTTPClient.If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
funcNewService¶added inv0.3.0
NewService creates a new Service.