How to specify URL in pagePath filters Basic reporting api V3

I am creating a web application that retrieves data through Core Reporting Api v3 from Google. I am using the PHP client library offered by Google. I'm currently trying to specify a page and get its pageviews for a range of time. Everything seems to work fine, except for the fact that if the filter with the filter ga:pagePath==http://link/uri , then I get 0 all the time regardless of the time range.

I think the problem is setting the value for this page. I want to have spearate data for the desktop version of the site and the smartphone version denoted by s. subdomain denoted by s. subdomain

Can someone give me some hints and / or tricks for using the necessary data?

Example URL: http://domain.com/user/profile/id/1 http://s.domain.com/user/profile/id/1

Thanks in advance!

+4
source share
1 answer

to implement Google Analytics by default, ga: pagePath does not include the schema or host name, so in your case you really want to filter using ga: hostname and ga: pagePath together.

I suggest you use the query explorer to create your queries and familiarize yourself with what will work. You can also use this tool to at least somehow understand what type of data the ga: pagePath and ga: hostname parameters are returned before trying to filter them. Finally, once you have the request you want, you can easily get the exact Core Reporting API request by clicking the URI request button.

Also see the section Combining Filters in GA GA Docs.

So, if you want the ga: pagepath filter for domain.com and s.domain.com separately, you could do something like

Filters = ha: pagePath == / user / profile / ID / 1; ha: hostname == domain.com Filters = ha: pagePath == / user / profile / ID / 1; ha: hostname == s.domain.com

+15
source

Source: https://habr.com/ru/post/1490325/


All Articles