Esempio n. 1
0
 /**
  * @param \DateTime $date_start
  * @param \DateTime $date_end
  * @param string[]  $campaign_ids
  * @param string[]  $ad_group_ids
  *
  * @return SitesDefinition
  */
 public function makeSitesDefinition(\DateTime $date_start, \DateTime $date_end, array $campaign_ids = null, array $ad_group_ids = null)
 {
     $report_definition = new SitesDefinition(new \ReportDefinition());
     $predicates = array();
     if ($campaign_ids != null) {
         $predicates[] = $this->adwords_reports->makePredicate('CampaignId', 'IN', $campaign_ids);
     }
     if ($ad_group_ids != null) {
         $predicates[] = $this->adwords_reports->makePredicate('AdGroupId', 'IN', $ad_group_ids);
     }
     $this->adwords_reports->buildReportDefinition('Sites Report', $predicates, $date_start, $date_end, $report_definition);
     return $report_definition;
 }
Esempio n. 2
0
 public function testFieldTypeDoNotSetted()
 {
     $this->setExpectedException('\\ebussola\\adwords\\reports\\exception\\FieldTypeNotDefinedException');
     $campaign_report = new CampaignPerformanceReportNoType(new ReportDefinition());
     $date_start = new \DateTime('-10 days');
     $date_end = new \DateTime('today');
     $this->reports->buildReportDefinition('Foo Report', array(), $date_start, $date_end, $campaign_report);
     $reports = $this->reports->downloadReports(array($campaign_report));
     foreach ($reports as $report) {
         foreach ($report as $row) {
             $this->assertObjectHasAttribute('budget', $row);
             $this->assertObjectHasAttribute('avgCPC', $row);
             $this->assertObjectHasAttribute('avgPosition', $row);
             $this->assertObjectHasAttribute('campaign', $row);
             $this->assertObjectHasAttribute('clicks', $row);
         }
     }
 }