gago: github.com/MarkEdmondson1234/gago/gago Index | Files

package gago

import "github.com/MarkEdmondson1234/gago/gago"

Index

Package Files

accounts.go antisample.go auth.go reports.go requests.go utilities.go

func Authenticate Uses

func Authenticate(file string) (*analyticsreporting.Service, *analytics.Service)

Authenticate Create clients for v4 and v3 Google Analytics API via JSON credentials file file is a filepath pointing to the location of a service credentials json file downloaded from your GCP console Remember to add the service account email to the GA Views you want to download from

func GetAccounts Uses

func GetAccounts(service *ga.Service)

GetAccounts gets the analytics accounts available for this user

func WriteCSV Uses

func WriteCSV(report *ParseReport, file *os.File)

WriteCSV Will write out in CSV format

type AccountSummary Uses

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

AccountSummary The account summary return object

func GetAccountSummary Uses

func GetAccountSummary(service *ga.Service) AccountSummary

GetAccountSummary Gets account summary including web properties and viewIds

type GoogleAnalyticsRequest Uses

type GoogleAnalyticsRequest struct {
    Service                                 *ga.Service
    ViewID, Start, End, Dimensions, Metrics string
    MaxRows, PageLimit                      int64
    UseResourceQuotas, AntiSample, Verbose  bool
    // contains filtered or unexported fields
}

GoogleAnalyticsRequest Make a request object to pass to GoogleAnalytics Service needs to be the reportingService from Analytics ViewID is the GA View to fetch from Start and End are strings in YYYY-MM-DD format Metrics is required, a comma separated string of valid ga: prefix Dimensions expects a comma separated string with valid ga: prefix MaxRows set to -1 to fetch all rows available PageLimit set how many pages to fetch each API request batch - default 10000 UseResourceQuotas if using GA360, set this to TRUE to get increased quota limits AntiSample set to true to attempt to antisample data by breaking up into smaller API calls Verbose Prints logs to stdout

type ParseReport Uses

type ParseReport struct {
    ColumnHeaderDimension []string                `json:"dimensionHeaderEntries,omitempty"`
    ColumnHeaderMetrics   []*ga.MetricHeaderEntry `json:"metricHeaderEntries,omitempty"`
    Rows                  []*ParseReportRow       `json:"values,omitempty"`
    DataLastRefreshed     string                  `json:"dataLastRefreshed,omitempty"`
    IsDataGolden          bool                    `json:"isDataGolden,omitempty"`
    Maximums              []string                `json:"maximums,omitempty"`
    Minimums              []string                `json:"minimums,omitempty"`
    RowCount              int64                   `json:"rowCount,omitempty"`
    FetchedRowCount       int64                   `json:"fetchedRowCount,omitempty"`
    SamplesReadCounts     googleapi.Int64s        `json:"samplesReadCounts,omitempty"`
    SamplingSpaceSizes    googleapi.Int64s        `json:"samplingSpaceSizes,omitempty"`
    Totals                []string                `json:"totals,omitempty"`
}

ParseReport A parsed Report after all batching and paging This takes all the API responses and puts it into a single more usable structure

func GoogleAnalytics Uses

func GoogleAnalytics(gagoRequest GoogleAnalyticsRequest) *ParseReport

GoogleAnalytics Make a request to the v4 Reporting API Supply the function a GoogleAnalyticsRequest struct object

type ParseReportRow Uses

type ParseReportRow struct {
    Dimensions []string `json:"dimensions,omitempty"`
    Metrics    []string `json:"metrics,omitempty"`
}

ParseReportRow A parsed row of ParseReport

Package gago imports 14 packages (graph) and is imported by 1 packages. Updated 2019-08-23. Refresh now. Tools for package owners.