c10b10
c10b10

Reputation: 357

Is there any way to get the subpages with the largest number of views using Google Analytics's API?

I'd like to see the pages with the largest number of post views that start with the "posts" slug: http://www.example.com/my-page/ should be ignored when counting, but http://www.example.com/posts/my-page/ should be included.

I'm not sure how to query the api to achieve this result.

Upvotes: 2

Views: 728

Answers (1)

jk.
jk.

Reputation: 14435

Add a filter to the api query:

filters=ga:pagePath=~(/posts/)

You can test it out using the Data Feed Query Explorer using the following values in these fields:

dimensions: ga:pagePath

metrics: ga:pageviews

filters: ga:pagePath=~(/posts/)

See also filter operators in the filters section for more information and to note that the forward slash / is not a reserved character so it can be used in your filter for matching. The backslash \ is reserved.

Upvotes: 4

Related Questions