report information (php)

Along with the main table data, the data returned from the API contains some high level information about the response. You can print it using the following. The containsSampledData field is important because it describes whether the API response has been sampled. Sampling can affect the results of your data and a common reason why the values returned from the API do not match the web interface. See the Sampling concept guide here: https:developers.google.comanalyticsresourcesconceptsgaConceptsSampling for more details.

private function printReportInfo(&$results) {
  $html = <<
Contains Sampled Data = {$results->getContainsSampledData()}
Kind                  = {$results->getKind()}
ID                    = {$results->getId()}
Self Link             = {$results->getSelfLink()}
HTML;

  print $html;
}