// Display results.
        if (isset($page->entries)) {
            foreach ($page->entries as $campaign) {
                printf("Campaign with name '%s' and id '%s' had the following stats " . "during the last week:\n", $campaign->name, $campaign->id);
                printf("  Impressions: %d\n", $campaign->campaignStats->impressions);
                printf("  Clicks: %d\n", $campaign->campaignStats->clicks);
                printf("  Cost: \$%.2f\n", $campaign->campaignStats->cost->microAmount / AdWordsConstants::MICROS_PER_DOLLAR);
                printf("  CTR: %.2f%%\n", $campaign->campaignStats->ctr * 100);
            }
        } else {
            print "No matching campaigns were found.\n";
        }
        // Advance the paging index.
        $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;
    } while ($page->totalNumEntries > $selector->paging->startIndex);
}
// Don't run the example if the file is being included.
if (__FILE__ != realpath($_SERVER['PHP_SELF'])) {
    return;
}
try {
    // Get AdWordsUser from credentials in "../auth.ini"
    // relative to the AdWordsUser.php file's directory.
    $user = new AdWordsUser();
    // Log every SOAP XML request and response.
    $user->LogAll();
    // Run the example.
    GetCampaignStatsExample($user);
} catch (Exception $e) {
    printf("An error has occurred: %s\n", $e->getMessage());
}
 public function testGetCampaignStatsExample()
 {
     GetCampaignStatsExample($this->user);
 }
            foreach ($page->summaryStats as $stats) {
                printf("\tSummary of type %s\n\t\t%s", $stats->summaryType, FormatStats($stats));
            }
        }
    } else {
        print "No video campaigns were found.\n";
    }
}
function FormatStats($stats)
{
    return sprintf("Views: %s, Cost: %s, Avg. CPC: %s, Avg. CPV: %s, " . "Avg. CPM: %s, 25%%: %s, 50%%: %s, 75%%: %s, 100%%: %s", empty($stats->views) ? '--' : $stats->views, empty($stats->cost) ? '--' : $stats->cost->microAmount, empty($stats->averageCpc) ? '--' : $stats->averageCpc->microAmount, empty($stats->averageCpv) ? '--' : $stats->averageCpv->microAmount, empty($stats->averageCpm) ? '--' : $stats->averageCpm->microAmount, empty($stats->quartile25Percents) ? '--' : $stats->quartile25Percents, empty($stats->quartile50Percents) ? '--' : $stats->quartile50Percents, empty($stats->quartile75Percents) ? '--' : $stats->quartile75Percents, empty($stats->quartile100Percents) ? '--' : $stats->quartile100Percents);
}
// Don't run the example if the file is being included.
if (__FILE__ != realpath($_SERVER['PHP_SELF'])) {
    return;
}
try {
    // Get AdWordsUser from credentials in "../auth.ini"
    // relative to the AdWordsUser.php file's directory.
    $user = new AdWordsUser();
    // Log every SOAP XML request and response.
    $user->LogAll();
    // Run the example.
    GetCampaignStatsExample($user, $campaignId);
} catch (OAuth2Exception $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
} catch (Exception $e) {
    printf("An error has occurred: %s\n", $e->getMessage());
}