How to get page views count for few (10) URLs from google analytics API?
<p>How to get page views count for few (10) URLs from google analytics API?</p>

<pre><code>$requests = [];
    foreach($urls as $url) {


        $dateRange = new Google_Service_AnalyticsReporting_DateRange();
        $dateRange-&gt;setStartDate($start_date);
        $dateRange-&gt;setEndDate($end_date);


        $sessions = new Google_Service_AnalyticsReporting_Metric();
        $sessions-&gt;setExpression("ga:pageviews");
        $sessions-&gt;setAlias("pageviews");

        $dimensionFilter = new Google_Service_AnalyticsReporting_DimensionFilter();
        $dimensionFilter-&gt;setDimensionName('ga:pagePath');
        $dimensionFilter-&gt;setOperator('BEGINS_WITH');
        $dimensionFilter-&gt;setExpressions([$url]);


        $dimensionFilterClause = new Google_Service_AnalyticsReporting_DimensionFilterClause();
        $dimensionFilterClause-&gt;setFilters([$dimensionFilter]);


        $request = new Google_Service_AnalyticsReporting_ReportRequest();
        $request-&gt;setViewId($this-&gt;view_id);
        $request-&gt;setDateRanges($dateRange);
        $request-&gt;setMetrics([$sessions]);
        $request-&gt;setDimensionFilterClauses([$dimensionFilterClause]);
        $requests[] = $request;
    }

    // Finally, we perform one large query for every URL address mentioned
    $body = new Google_Service_AnalyticsReporting_GetReportsRequest();
    $body-&gt;setReportRequests([$requests]);

    $reports = $this-&gt;analytics-&gt;reports-&gt;batchGet( $body );
</code></pre>

<p>If URLs count is more than 5 throwing exception with message:</p>

<blockquote>
  <p>There are too many requests in the batch request. The max allowed is 5</p>
</blockquote>

<p>How I can do it?
GA API version 4.</p>