Views filter string not working

Created on 6 March 2023, about 2 years ago
Updated 6 June 2023, almost 2 years ago

Problem/Motivation

Some queries with views filter not working.

I'm using a fullPageUrl (G4) filter with operator contains.
I get the following error:

Error: Using $this when not in object context in Drupal\google_analytics_reports\Plugin\views\query\GoogleAnalyticsQuery::Drupal\google_analytics_reports\Plugin\views\query\{closure}() (line 584 of modules/contrib/google_analytics_reports/src/Plugin/views/query/GoogleAnalyticsQuery.php).

Steps to reproduce

  1. Edit the views Google Analytics Summary
  2. Edit the attachment Top Pages
  3. Add a filter Full page URL
  4. Use the operator contains with a string
  5. Generate the preview
🐛 Bug report
Status

Active

Version

4.0

Component

Reports module

Created by

🇮🇹Italy marco.aresu Cagliari

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the “VDC” tag instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • 🇺🇞United States zenphp Norwood, NY

    There are a couple of levels of Lambda functions contained within the GoogleAnalyticsQuery::query() method. They have all been defined as static lambdas, but buried within them is a call to $this->t().

  • @zenphp opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇹Italy marco.aresu Cagliari

    Operator dimension filters are wrong.
    I fixed operator as described in this article
    I fixed these operators.

    1. contains: =@
    2. not: !@
    3. regular_expression: =~
    4. not_regular_expression: !~
  • Status changed to Needs work 5 months ago
  • 🇚🇊Canada megan_m

    I added this patch and I'm still having problems with a lot of filters. I have a view showing visitors by country and I can't apply most filters to those country fields.

    Error is:

    Error occurred! Google\ApiCore\ApiException: { "message": "Unsupported regular expression syntax in value. See https:\/\/github.com\/google\/re2\/wiki\/Syntax for supported syntax. invalid perl operator: (?!", "code": 3, "status": "INVALID_ARGUMENT", "details": [] }

    (I actually need to filter out when the country is not set, but there's no not empty filter, so I'm trying to do this some other way. Any attempt to filter on "does not contain" or regular expressions throw this error).

    I've played with other filters and others don't work either. For example, try filtering on Device, does not contain "Galaxy"

Production build 0.71.5 2024