Search code examples
google-analyticsgoogle-data-apigoogle-analytics-api

Google Analytics API: filter by URI?


My site has user profiles that are accessible via URLs that look like this: www.domain.com/profile/123/.... I want to show users page view statistics of their profiles, but need to be able to do wildcards.

For example, this works:

filters=ga:pagePath==/profile/123/

The problem is that there are potentially other URI segments that follow /profile/123/. I want to do something like this (does not work):

filters=ga:pagePath==/profile/123/*

Suggestions?


Solution

  • Use the 'Contains a match for the regular expression' operator (~) from the Dimension Filters.

    filters=ga:pagePath=~/profile/123/*