Expect integer in dimensionFilter of GA4 Api

Viewed 16

I want to find most visited sites which includes my/path.

I can get the most visited pages across the system so I want to add a filter to this request. When I add this filter I get the following output:

[Exception]
Expect integer.

This is my filter:

'dimensionFilter' => new FilterExpression([
    'filter' => new Filter([
    'field_name' => 'fullPageUrl',
    'string_filter' => new StringFilter([
        'value' => 'my/path',
        'match_type' => 'CONTAINS'
        ])
    ])
])

What am I missing?

1 Answers

OK, I found an answer. Instead of 'CONTAINS', I edited as:

Filter\StringFilter\MatchType::CONTAINS

Which is actually an integer.

Related