googleapis / googleapis/google-cloud-ruby
Circular dependency found for dimension for google-analytics-data
- Dominant language
- Ruby
- Stars
- 1.4k
- Forks
- 578
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 166
Description
Thanks for stopping by to let us know something could be better!
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
- Search the issues already opened: https://github.com/googleapis/google-cloud-ruby/issues
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby
If you are still having issues, please be sure to include as much information as possible:
#### Environment details
- OS: macOS 10.15.6
- Ruby version: 2.6.5
- Gem name and version: google-analytics-data (0.4.0)
#### Steps to reproduce
I am using the google-analytics-data gem to retrieve Google Analytics reports. When I try to convert the value of 'searchTerm' to lowercase, I encountered the following error. I referred to this document: [CaseExpression](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/Dimension#CaseExpression) Could you please let me know if this attribute is not supported?
#### Code example
```ruby
credentials_path = 'sample.json'
client = Google::Analytics::Data.analytics_data { |config| config.credentials = credentials_path }
view_id = 'properties/xxxxxxxx'
dimension_filters = []
dimension_filters << Google::Analytics::Data::V1beta::Filter.new(
field_name: 'searchTerm',
string_filter: Google::Analytics::Data::V1beta::Filter::StringFilter.new(
value: "^.+$",
match_type: Google::Analytics::Data::V1beta::Filter::StringFilter::MatchType::FULL_REGEXP
)
)
filter_expression = Google::Analytics::Data::V1beta::FilterExpression.new(
and_group: Google::Analytics::Data::V1beta::FilterExpressionList.new(
expressions: dimension_filters.map{|filter| {filter: filter}},
)
)
request = Google::Analytics::Data::V1beta::RunReportRequest.new(
property: view_id,
dimensions: [
Google::Analytics::Data::V1beta::Dimension.new(
name: 'searchTerm',
dimension_expression: Google::Analytics::Data::V1beta::DimensionExpression.new(
lower_case: Google::Analytics::Data::V1beta::DimensionExpression::CaseExpression.new(dimension_name: 'searchTerm')
)
),
Google::Analytics::Data::V1beta::Dimension.new(name: 'pagePath'),
],
date_ranges: [
Google::Analytics::Data::V1beta::DateRange.new(start_date: 'yesterday', end_date: 'yesterday')
],
dimension_filter: filter_expression
)
r = client.run_report(request)
```
#### Full backtrace
```sh
Google::Cloud::InvalidArgumentError: 3:Circular dependency found for dimension: searchTerm. debug_error_string:{"created":"@1688623183.696165000","description":"Error received from peer ipv4:127.0.0.1:7890","file":"src/core/lib/surface/call.cc","file_line":906,"grpc_message":"Circular dependency found for dimension: searchTerm","grpc_status":3}
```
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.