Skip to content

Commit e442e0b

Browse files
committed
Code didn't compile, and Property path was incorrect.
1 parent ceb128c commit e442e0b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

analytics-data/QuickStart/QuickStart.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,21 @@ static void SampleRunReport(string propertyId="YOUR-GA4-PROPERTY-ID")
5252
// Initialize request argument(s)
5353
RunReportRequest request = new RunReportRequest
5454
{
55-
Property = "property/" + propertyId,
55+
Property = "properties/" + propertyId,
5656
Dimensions = { new Dimension{ Name="city"}, },
5757
Metrics = { new Metric{ Name="activeUsers"}, },
5858
DateRanges = { new DateRange{ StartDate="2020-03-31", EndDate="today"}, },
5959
};
6060

6161
// Make the request
62-
PagedEnumerable<RunReportResponse, DimensionHeader> response = client.RunReport(request);
62+
var response = client.RunReport(request);
6363
// [END analyticsdata_run_report]
6464

6565
// [START analyticsdata_run_report_response]
6666
Console.WriteLine("Report result:");
67-
foreach(RunReportResponse page in response.AsRawResponses())
67+
foreach(Row row in response.Rows)
6868
{
69-
foreach(Row row in page.Rows)
70-
{
71-
Console.WriteLine("{0}, {1}", row.DimensionValues[0].Value, row.MetricValues[0].Value);
72-
}
69+
Console.WriteLine("{0}, {1}", row.DimensionValues[0].Value, row.MetricValues[0].Value);
7370
}
7471
// [END analyticsdata_run_report_response]
7572
}

0 commit comments

Comments
 (0)