data

package
v1.42.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package data is an auto-generated package for the Google Analytics Data API.

Accesses report data in Google Analytics.

NOTE: This package is in alpha. It is not stable, and is likely to change.

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type AlphaAnalyticsDataCallOptions

type AlphaAnalyticsDataCallOptions struct {
	RunReport            []gax.CallOption
	RunPivotReport       []gax.CallOption
	BatchRunReports      []gax.CallOption
	BatchRunPivotReports []gax.CallOption
	GetMetadata          []gax.CallOption
	RunRealtimeReport    []gax.CallOption
}

AlphaAnalyticsDataCallOptions contains the retry settings for each method of AlphaAnalyticsDataClient.

type AlphaAnalyticsDataClient

type AlphaAnalyticsDataClient struct {

	// The call options for this service.
	CallOptions *AlphaAnalyticsDataCallOptions
	// contains filtered or unexported fields
}

AlphaAnalyticsDataClient is a client for interacting with Google Analytics Data API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Google Analytics reporting data service.

func NewAlphaAnalyticsDataClient

func NewAlphaAnalyticsDataClient(ctx context.Context, opts ...option.ClientOption) (*AlphaAnalyticsDataClient, error)

NewAlphaAnalyticsDataClient creates a new alpha analytics data client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Google Analytics reporting data service.

Example
package main

import (
	"context"

	data "cloud.google.com/go/analytics/data/apiv1alpha"
)

func main() {
	ctx := context.Background()
	c, err := data.NewAlphaAnalyticsDataClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*AlphaAnalyticsDataClient) BatchRunPivotReports

BatchRunPivotReports returns multiple pivot reports in a batch. All reports must be for the same Entity.

Example
package main

import (
	"context"

	data "cloud.google.com/go/analytics/data/apiv1alpha"
	datapb "google.golang.org/genproto/googleapis/analytics/data/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := data.NewAlphaAnalyticsDataClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datapb.BatchRunPivotReportsRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.BatchRunPivotReports(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AlphaAnalyticsDataClient) BatchRunReports

BatchRunReports returns multiple reports in a batch. All reports must be for the same Entity.

Example
package main

import (
	"context"

	data "cloud.google.com/go/analytics/data/apiv1alpha"
	datapb "google.golang.org/genproto/googleapis/analytics/data/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := data.NewAlphaAnalyticsDataClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datapb.BatchRunReportsRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.BatchRunReports(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AlphaAnalyticsDataClient) Close

func (c *AlphaAnalyticsDataClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*AlphaAnalyticsDataClient) Connection

func (c *AlphaAnalyticsDataClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*AlphaAnalyticsDataClient) GetMetadata

GetMetadata returns metadata for dimensions and metrics available in reporting methods. Used to explore the dimensions and metrics. In this method, a Google Analytics GA4 Property Identifier is specified in the request, and the metadata response includes Custom dimensions and metrics as well as Universal metadata.

For example if a custom metric with parameter name levels_unlocked is registered to a property, the Metadata response will contain customEvent:levels_unlocked. Universal metadata are dimensions and metrics applicable to any property such as country and totalUsers.

Example
package main

import (
	"context"

	data "cloud.google.com/go/analytics/data/apiv1alpha"
	datapb "google.golang.org/genproto/googleapis/analytics/data/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := data.NewAlphaAnalyticsDataClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datapb.GetMetadataRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetMetadata(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AlphaAnalyticsDataClient) RunPivotReport

RunPivotReport returns a customized pivot report of your Google Analytics event data. Pivot reports are more advanced and expressive formats than regular reports. In a pivot report, dimensions are only visible if they are included in a pivot. Multiple pivots can be specified to further dissect your data.

Example
package main

import (
	"context"

	data "cloud.google.com/go/analytics/data/apiv1alpha"
	datapb "google.golang.org/genproto/googleapis/analytics/data/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := data.NewAlphaAnalyticsDataClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datapb.RunPivotReportRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.RunPivotReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AlphaAnalyticsDataClient) RunRealtimeReport

RunRealtimeReport the Google Analytics Realtime API returns a customized report of realtime event data for your property. These reports show events and usage from the last 30 minutes.

Example
package main

import (
	"context"

	data "cloud.google.com/go/analytics/data/apiv1alpha"
	datapb "google.golang.org/genproto/googleapis/analytics/data/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := data.NewAlphaAnalyticsDataClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datapb.RunRealtimeReportRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.RunRealtimeReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*AlphaAnalyticsDataClient) RunReport

RunReport returns a customized report of your Google Analytics event data. Reports contain statistics derived from data collected by the Google Analytics tracking code. The data returned from the API is as a table with columns for the requested dimensions and metrics. Metrics are individual measurements of user activity on your property, such as active users or event count. Dimensions break down metrics across some common criteria, such as country or event name.

Example
package main

import (
	"context"

	data "cloud.google.com/go/analytics/data/apiv1alpha"
	datapb "google.golang.org/genproto/googleapis/analytics/data/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := data.NewAlphaAnalyticsDataClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datapb.RunReportRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.RunReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

Jump to

Keyboard shortcuts

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