Google Reporting API ReportRequest cannot get all URL to count pageviews

195 Views Asked by At

I'm using Google Reporting API and C# client to get all pageviews of some urls in my page
Example of urls:

/relative-path-1/title-of-url-ar1234.html  
/relative-path-2/title-of-url-2-ar1234.html

But in Google Analytics I can see my urls come with multiple query string

/relative-path-1/title-of-url-ar1234.html  
/relative-path-1/title-of-url-ar1234.html?q=1
/relative-path-2/title-of-url-2-ar1234.html
/relative-path-2/title-of-url-2-ar1234.html?q=1

When I use C# request to Reporting API

var dimensionFilter = new DimensionFilter
                {
                    DimensionName = "ga:pagePath",
                    Expressions = pagePathList,
                    Operator__ = "IN_LIST"
                };
                var dimensionFilterClause = new DimensionFilterClause();
                dimensionFilterClause.Filters = new List<DimensionFilter> { dimensionFilter };

                //Get required View Id from configuration
                var ViewId = "xxxxxxxxxx";

                // Create the Request object.
                var reportRequest = new ReportRequest
                {
                    DateRanges = new List<DateRange> { dateRange },
                    Metrics = metrics,
                    Dimensions = dimensions,
                    ViewId = ViewId,
                    PageSize = 25000,
                    DimensionFilterClauses = new List<DimensionFilterClause> { dimensionFilterClause },
                };
                var getReportsRequest = new GetReportsRequest();
                getReportsRequest.ReportRequests = new List<ReportRequest> { reportRequest };

Reporting API return only the exact urls in the list not full urls with query string because the operator "IN_LIST"

Example
In Google Analytics

/relative-path-1/title-of-url-ar1234.html: 100 pageviews
/relative-path-1/title-of-url-ar1234.html?q=1: 50 pageviews
/relative-path-2/title-of-url-2-ar1234.html: 20 pageviews
/relative-path-2/title-of-url-2-ar1234.html?q=1: 30 pageviews

Query return

/relative-path-1/title-of-url-ar1234.html: 100 pageviews
/relative-path-2/title-of-url-2-ar1234.html: 20 pageviews

It should be

/relative-path-1/title-of-url-ar1234.html: 150 pageviews (combine /relative-path-1/title-of-url-ar1234.html and /relative-path-1/title-of-url-ar1234.html ?q=1)
/relative-path-2/title-of-url-2-ar1234.html: 50 pageviews (combine /relative-path-2/title-of-url-2-ar1234.html and /relative-path-2/title-of-url-2-ar1234.html)

How can I get all pageviews of urls not only exact one in the list
I tried to change the operator to "PARTIAL" but the expression can not be a list of urls
Thanks

0

There are 0 best solutions below