totals for all results (php)

As mentioned in the pagination information section (http:snippetlib.comgoogle_analyticspagination_information_php ), a query to the Core Reporting API can match many rows of data in Google Analytics, but only return a subset of data. The total metric values for all the matched rows are returned in the totalsForAllResults object. This data is useful for calculating averages.

private void printTotalsForAllResults(&results) {
  $totals = $results->getTotalsForAllResults();

  foreach ($totals as $metricName => $metricTotal) {
    $html .= \"Metric Name  = $metricName\\n\";
    $html .= \"Metric Total = $metricTotal\";
  }

  print $html;
}