Skip to content

Instantly share code, notes, and snippets.

@tjtate
Created July 18, 2014 18:12
Show Gist options
  • Save tjtate/3b59137e6668eaeefd0f to your computer and use it in GitHub Desktop.
Save tjtate/3b59137e6668eaeefd0f to your computer and use it in GitHub Desktop.
<?php
private function getGoogleData($customerIDDim, $customerNumber, $value) {
$params = array(
'metrics' => $value[1],
'dimensions' => $value[0],
'filters' => $customerIDDim.'=='.$customerNumber,
);
$results = $this->googleAuth->_query($params);
$reformated = array();
if (isset($results['rows'])) {
foreach ($results['rows'] as $key => $valuez) {
array_pop($valuez);
$finalarray = array();
foreach ($valuez as $newkey => $newvalue) {
$finalarray[$value[2][$newkey]] = $newvalue;
}
array_push ($reformated, $finalarray);
}
return $reformated;
}
else {
return $results['totalsForAllResults'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment