googleanalytics

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateWidget

func CreateWidget(resp *ga.GetReportsResponse, maxRows int) (*termui.Table, error)

CreateWidget parses the Analytics Reporting API V4 response and returns a termui tablee. It will only add X maxRows if passed. If 0 is passed for maxRows it will add all the rows.

func PrintResponse

func PrintResponse(resp *ga.GetReportsResponse, maxRows int) error

PrintResponse parses and prints the Analytics Reporting API V4 response in the form of a tabwriter table. It will only print X maxRows if passed. If 0 is passed for maxRows it will print all the rows.

Types

type Client

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

Client holds the information for a Google Analytics reporting client.

func New

func New(keyfile string, debug bool) (*Client, error)

New takes a keyfile for auththentication and returns a new Google Analytics Reporting Client struct. Your credentials should be obtained from the Google Developer Console (https://console.developers.google.com). Navigate to your project, then see the "Credentials" page under "APIs & Auth". To create a service account client, click "Create new Client ID", select "Service Account", and click "Create Client ID". A JSON key file will then be downloaded to your computer.

func (*Client) GetProfileName

func (c *Client) GetProfileName(profileID string) (name string, err error)

GetProfileName returns the name of a Google Analytics profile.

func (*Client) GetRealtimeActiveUsers

func (c *Client) GetRealtimeActiveUsers(viewID string) (string, error)

GetRealtimeActiveUsers queries the Analytics Realtime Reporting API V3 using the Analytics Reporting API V3 service object. It returns the Analytics Realtime Reporting API V3 response for how many active users are currently on the site.

func (*Client) GetReport

func (c *Client) GetReport(viewID string) (*ga.GetReportsResponse, error)

GetReport queries the Analytics Reporting API V4 using the Analytics Reporting API V4 service object. It returns the Analytics Reporting API V4 response

Jump to

Keyboard shortcuts

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