}
 foreach ($dates as $key => $processDate) {
     //echo '<br> Process DATE: '.$processDate;
     $startDate = $processDate;
     $endDate = $processDate;
     foreach ($dimensions as $key => $value) {
         print_r("---DIMENSIONS---" . json_encode($value));
         $result = $client->get_statistics(array('format' => 'json', 'account_id' => $account_id, 'dimensions' => json_encode($value), 'metrics' => json_encode(array('impression', 'click', 'click_rate', 'reach_impression', 'total_cost', 'confirmed_tracked_conversion', 'expand', 'event', 'average_expand_time', 'pageview', 'average_visibility_time', 'progress_100', 'progress_50', 'user_play', 'close', 'impression_adwords', 'click_adwords', 'cost_adwords', 'bounce_rate', 'average_time_spent_on_site', 'cost_per_pageview')), 'start_date' => $processDate, 'end_date' => $processDate));
         echo '<pre>';
         ////print_r($result->headers);
         //print_r($result);
         //die();
         /*
          ************* METADATA **************
          */
         $adspacesMeta = getAdspaces($mysqli);
         $campaignsMeta = getCampaigns($mysqli);
         $channelsMeta = getChannels($mysqli);
         $projectsMeta = getProjects($mysqli);
         $creativesMeta = getCreatives($mysqli);
         $adnetworksMeta = getAdnetworks($mysqli);
         $insertionsMeta = getInsertions($mysqli);
         $agesMeta = getAges($mysqli);
         $ispsMeta = getIsps($mysqli);
         $opsMeta = getOps($mysqli);
         $browsersMeta = getBrowsers($mysqli);
         $socialsMeta = getSocials($mysqli);
         $gendersMeta = getGenders($mysqli);
         $GLOBALS["metrics"] = getMetrics($mysqli);
         $metrics = $GLOBALS["metrics"];
         /*
 }
 foreach ($dates as $key => $processDate) {
     //echo '<br> Process DATE: '.$processDate;
     $startDate = $processDate;
     $endDate = $processDate;
     foreach ($dimensions as $key => $value) {
         print_r("---DIMENSIONS---" . json_encode($value));
         $result = $client->get_statistics(array('format' => 'json', 'account_id' => $account_id, 'dimensions' => json_encode($value), 'metrics' => json_encode(array('impression', 'click', 'click_rate', 'reach_impression', 'total_cost', 'confirmed_tracked_conversion', 'expand', 'event', 'average_expand_time', 'pageview', 'average_visibility_time', 'progress_100', 'progress_50', 'user_play', 'close', 'impression_adwords', 'click_adwords', 'cost_adwords', 'bounce_rate', 'average_time_spent_on_site', 'cost_per_pageview')), 'start_date' => $processDate, 'end_date' => $processDate));
         echo '<pre>';
         ////print_r($result->headers);
         //print_r($result);
         //die();
         /*
          ************* METADATA **************
          */
         $adspacesMeta = getAdspaces($connSqlsrv);
         $campaignsMeta = getCampaigns($connSqlsrv);
         $channelsMeta = getChannels($connSqlsrv);
         $projectsMeta = getProjects($connSqlsrv);
         $creativesMeta = getCreatives($connSqlsrv);
         $adnetworksMeta = getAdnetworks($connSqlsrv);
         $insertionsMeta = getInsertions($connSqlsrv);
         $agesMeta = getAges($connSqlsrv);
         $ispsMeta = getIsps($connSqlsrv);
         $opsMeta = getOps($connSqlsrv);
         $browsersMeta = getBrowsers($connSqlsrv);
         $socialsMeta = getSocials($connSqlsrv);
         $gendersMeta = getGenders($connSqlsrv);
         $GLOBALS["metrics"] = getMetrics($connSqlsrv);
         $metrics = $GLOBALS["metrics"];
         $metadata = $result->body->metadata;