Skip to content

Commit

Permalink
runReport: enable MetricAggregations
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokisan committed Nov 21, 2022
1 parent d7f0736 commit 89759d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/run_report/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func run() error {
EndDate: "2022-10-01",
},
ga4data.RunReportRequestWithDimensions(dimensions),
ga4data.RunReportRequestWithMetricAggregations([]string{"MINIMUM", "MAXIMUM"}),
ga4data.RunReportRequestWithMetrics(metrics),
ga4data.RunReportRequestWithPropertyQuota(),
))
Expand Down
7 changes: 7 additions & 0 deletions run_report_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ func Dimensions(dimensions []string) []*analyticsdata.Dimension {
return dims
}

// RunReportRequestWithMetricAggregations :
func RunReportRequestWithMetricAggregations(values []string) func(*analyticsdata.RunReportRequest) {
return func(req *analyticsdata.RunReportRequest) {
req.MetricAggregations = values
}
}

// Metrics :
func Metrics(metrics []string) []*analyticsdata.Metric {
mets := make([]*analyticsdata.Metric, len(metrics))
Expand Down

0 comments on commit 89759d6

Please sign in to comment.