You say it's possible to get the report in memory or a temporary file and
consume it directly, but you don't say how?
I want to run getcampaignstats.php in V201309, it seems this file is
completely missing in this new version, and only csv and xml for download
only.
Please show how using PHP I can get the same info as in the last version
V201306.
This is what I have at the moment how do I change this for the new version.
I have added the old file directly into the new version and get the
following
"An error has occurred: [SelectorError.INVALID_FIELD_NAME @
serviceSelector; trigger:'Impressions" - and more.
*Showing a PHP version in full of adhoc reports should be an essential part
of your documentation !*
<mycode>
function GetCampaignStatsExample(AdWordsUser $user) {
// Get the service, which loads the required classes.
$campaignService = $user->GetService('CampaignService', ADWORDS_VERSION);
// Create selector.
$selector = new Selector();
$selector->fields =
array('Id', 'Name', 'Impressions', 'Clicks', 'Cost', 'Ctr',
'Conversions' );
$selector->predicates[] =
new Predicate('Impressions', 'GREATER_THAN', array(0));
// Set date range to request stats for.
$dateRange = new DateRange();
$dateRange->min = date('Ymd', strtotime('-0 day'));
$dateRange->max = date('Ymd', strtotime('-0 day'));
$selector->dateRange = $dateRange;
// Create paging controls.
$selector->paging = new Paging(0,
AdWordsConstants::RECOMMENDED_PAGE_SIZE);
do {
// Make the get request.
$page = $campaignService->get($selector);
// 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);
echo "\nName".$campname = $campaign->name; //name
echo "\nImpressions".$impressions = $campaign->campaignStats->impressions;
//impressions
echo "\nClicks".$clicks = $campaign->campaignStats->clicks; //clicks
echo "\nCost".$cost = $campaign->campaignStats->cost->microAmount /
AdWordsConstants::MICROS_PER_DOLLAR; //cost
echo "\nConversions".$conversions = $campaign->campaignStats->conversions;
//conversions
echo "\nCtr".$ctr = $campaign->campaignStats->ctr * 100;
echo "\nCPA".$cpa = $cost / $conversions;
echo "\nConvrate".$conversionrate = $conversions / $clicks;
echo "\nCPC".$cpc = $cost / $clicks;
</mycode>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.