Search code examples
google-analyticsgoogle-analytics-filters

Regex to View Pages Containing Any Word from a List


I need to return a Google Analytics Behavior report for pages filtered by any page that contains a word from a list.

In the Advanced Filter, I tried the Containing filter with pipes to separate the words.

Include > Page > Containing > apple|orange|grape

but that returned all pages and did not filter anything.

Then I tried a Regex approximation to include one or more instances of any part of the word.

Include > Page > Regex > apple|orange|grape
Include > Page > Regex > (apple?|orange?|grape?)
Include > Page > Regex > (?:apple|orange|grape)

No results.

The regex should match any page URL that contains any of the words in the list. Plural and partial hits should be included. The folder directory is variable. I'm looking for any page that contains the word anywhere.


Solution

  • This configuration:

    Include > Page > Containing > apple|orange|grape
    

    You say it returns you all results but in theory none should come back.

    This configuration:

    Include > Page > Regex > apple|orange|grape
    

    It does what you want, which is to return URLs that contain apple and/or orange and/or grape.

    So check that the setting is indeed this.

    [EDIT]

    Note: there is a data lenght field limit to 256 characters in a Filter pattern.