Hello Steve,

Should be as easy as changing this line to:

          $selector->fields = array('Date', 'Id', 'TotalCost', 'HourOfDay');

Note you'll need to update the response XML parser to account for extra 
rows.


-Danial, AdWords API Team.


On Tuesday, April 22, 2014 7:27:41 PM UTC+4, Nypo77 wrote:
>
> Dear Community,
>
> I am downloading a CAMPAIGN PERFORMANCE REPORT for a period of 1 day, and 
> this works just fine. 
>
> Here is the code how I do the setup for the it:
>
>         // Create selector.
>         $selector = new \Selector();
>         $selector->fields = array('Date', 'Id', 'TotalCost');
>
>         // Filter
>         $selector->predicates[] = new \Predicate('Id', 'IN', 
> ['campaignid1', 'campaignid2', ...]);
>         $selector->predicates[] = new \Predicate('Clicks', 'GREATER_THAN', 
> 0);
>
>         // create daterange
>         $dateRange = new \DateRange();
>         $dateRange->min = $date->format('Ymd');
>         $dateRange->max = $date->format('Ymd');
>         $selector->dateRange = $dateRange;
>
>         // Create report definition.
>         $reportDefinition = new \ReportDefinition();
>         $reportDefinition->selector = $selector;
>         $reportDefinition->reportName = 'Campaign Performance Report #' . 
> uniqid();
>         $reportDefinition->dateRangeType = 'CUSTOM_DATE';
>         $reportDefinition->reportType = 'CAMPAIGN_PERFORMANCE_REPORT';
>         $reportDefinition->downloadFormat = 'XML';
>         $reportDefinition->includeZeroImpressions = FALSE;
>
>         // options for report call
>         $options = array('version' => 'v201309', 'returnMoneyInMicros' => 
> FALSE);
>
> and then I do the request and it works fine.
>
> Nevertheless with new features requested for my application I need to 
> segment this data on a hourly basis. 
> I found on several forum entries that it is possible (here for example: 
> *https://groups.google.com/forum/#!newtopic/adwords-api/adwords-api/gnmRZZZcPsg
>  
> <https://groups.google.com/forum/#!newtopic/adwords-api/adwords-api/gnmRZZZcPsg>*).
>  
> I checked the specified documentation 
> (*https://developers.google.com/adwords/api/docs/appendix/reports#campaign 
> <https://developers.google.com/adwords/api/docs/appendix/reports#campaign>*), 
> found the *HourOfDay* field, about which was stated that it should 
> segment the report per hours.
>
> My issue is that I simply could not find how does it look like in PHP to 
> use this HourOfDay. Probably missing something obvoius. I tried several 
> ways, I thought would work but with no success.
>
> So can anybody help me out, how to change my above PHP example to be able 
> to use this HourOfDay segment?
>
>
> Thanks a lot!
> *--Steve*
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to