You are here

protected function GAFeed::sanitizeReport in Google Analytics Counter 7.2

Sanitize report data

1 call to GAFeed::sanitizeReport()
GAFeed::queryReportFeed in ./GAFeed.lib.inc
Query and sanitize report data

File

./GAFeed.lib.inc, line 384
Provides the GAFeed object type and associated methods.

Class

GAFeed
GAFeed class to authorize access to and request data from the Google Analytics Data Export API.

Code

protected function sanitizeReport() {

  /* Named keys for report values */
  $this->results->rawRows = $this->results->rows;
  $this->results->rows = array();
  foreach ($this->results->rawRows as $row_key => $row_value) {
    foreach ($row_value as $item_key => $item_value) {
      $this->results->rows[$row_key][str_replace('ga:', '', $this->results->columnHeaders[$item_key]->name)] = $item_value;
    }
  }
  unset($this->results->rawRows);

  /* Named keys for report totals */
  $this->results->rawTotals = $this->results->totalsForAllResults;
  $this->results->totalsForAllResults = array();
  foreach ($this->results->rawTotals as $row_key => $row_value) {
    $this->results->totalsForAllResults[str_replace('ga:', '', $row_key)] = $row_value;
  }
  unset($this->results->rawTotals);
}