1

我正在使用 .NET 5 和 nuget 包 Google.Analytics.Data.V1Beta 来查询 Google Analytics。但我需要使用 event_category 和 event_label 查询事件,我收到此错误:“Field customEvent:event_category is not a valid dimension”。这是我的代码:

            var click = new FilterExpression
            {
                Filter = new Filter
                {
                    FieldName = "ga:event_category",
                    StringFilter = new Filter.Types.StringFilter
                    {
                        CaseSensitive = false,
                        MatchType = Filter.Types.StringFilter.Types.MatchType.Exact,
                        Value = "click"
                    }
                },
            };
            var request = new RunReportRequest
            {
                Property = $"properties/{_settings.GoogleAnalytics.PropertyId}",
                Dimensions = {new Dimension {Name = "eventName"}, new Dimension {Name = "customEvent:event_category" } },
                DimensionFilter = click,
                Metrics = {new Metric {Name = "eventCount"}},
                DateRanges =
                {
                    new DateRange
                        {StartDate = startDate.ToString("yyyy-MM-dd"), EndDate = endDate.ToString("yyyy-MM-dd")}
                }
            };

            var response = await _analyticsClient.GetClient().RunReportAsync(request);

如何将 event_category 和 event_label 传递给查询?

4

0 回答 0