Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics API Filter for Index/Homepage

I'm trying to figure out how to construct a filter that will retrieve just the pageviews of my homepage using the Google Analytics API. I can get pageviews of other pages, for instance:

ga:hostname==mydomain.com;ga:pagePath=~/my-page/$

But I want pageviews of just mydomain.com/. I've tried the following and they don't work:

ga:hostname==mydomain.com;ga:pagePath=~//$ ga:hostname==mydomain.com;ga:pagePath=~///$ ga:hostname==mydomain.com;ga:pagePath=~/\//$ ga:hostname==mydomain.com;ga:pagePath=~/[\S]{1}/$

Any ideas? Thanks.

like image 266
Sam Avatar asked Mar 11 '26 04:03

Sam


1 Answers

Try this:

ga:pagePath==/

If you want to use a regular expression, it would look like this:

ga:pagePath=~^/$

Here's a demo of this query using the Query Explorer:

like image 69
Philip Walton Avatar answered Mar 13 '26 17:03

Philip Walton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!