php - How to set date range in Bid Landscapes - Adwords API -


i playing bid landscapes, , official documentation describes:

bid landscapes way research information estimated performance ad groups , criteria.

i testing api in adgroup level, , following piece of code has been written:

public function test_bid_simulator() {     $user = new adwordsuser();     $user->setclientcustomerid('*******');     $dataservice = $user->getservice('dataservice', 'v201509');      $selector = new selector();     $selector->fields = array('adgroupid', 'startdate', 'enddate',         'bid', 'localclicks', 'localcost', 'localimpressions');      // create predicates.     $selector->predicates[] = new predicate('campaignid', 'in', array('****', '****', '****', '****'));      // $selector->daterange = new daterange();     // $selector->daterange->min = date('ymd', strtotime('2016/01/28'));     // $selector->daterange->max = date('ymd', strtotime('2016/02/03'));      {         // make getadgroupbidlandscape request.         $page = $dataservice->getadgroupbidlandscape($selector);          // display results.         if (isset($page->entries)) {             foreach ($page->entries $bidlandscape) {                 printf("found adgroup bid landscape id '%s' start "                         . "date '%s', end date '%s', , landscape points:\n",                         $bidlandscape->adgroupid,                         $bidlandscape->startdate,                         $bidlandscape->enddate);                 foreach ($bidlandscape->landscapepoints $bidlandscapepoint) {                     printf("  bid: %.0f => clicks: %d, cost: %.0f, impressions: %d\n",                              $bidlandscapepoint->bid->microamount,                              $bidlandscapepoint->clicks,                              $bidlandscapepoint->cost->microamount,                              $bidlandscapepoint->impressions);                 }                 print "\n";             }         }         // advance paging index.         $selector->paging->startindex += adwordsconstants::recommended_page_size;     } while (isset($page->entries) && count($page->entries) > 0);      if ($selector->paging->startindex === 0) {         print "no adgroup bid landscapes found.\n";     } } 

this code works fine, , output similar to:

found adgroup bid landscape id '****' start date   '20160131', end date '20160206', , landscape points:   bid: 60000 => clicks: 0, cost: 0, impressions: 38   bid: 110000 => clicks: 0, cost: 0, impressions: 70   bid: 150000 => clicks: 0, cost: 0, impressions: 97   bid: 210000 => clicks: 0, cost: 0, impressions: 116   bid: 280000 => clicks: 0, cost: 0, impressions: 126   bid: 470000 => clicks: 0, cost: 0, impressions: 136  found adgroup bid landscape id '****' start date '20160131', end date '20160206', , landscape points:   bid: 20000 => clicks: 0, cost: 0, impressions: 16   bid: 40000 => clicks: 0, cost: 0, impressions: 89   bid: 60000 => clicks: 0, cost: 0, impressions: 138   bid: 100000 => clicks: 0, cost: 0, impressions: 183   bid: 160000 => clicks: 0, cost: 0, impressions: 218   bid: 240000 => clicks: 0, cost: 0, impressions: 234   bid: 390000 => clicks: 0, cost: 0, impressions: 256  etc. 

by default, api picks previous week range ending 2 days now. instance, if today 2016/02/08, api range between 2016/01/31 , 2016/02/06. problem how set specific date range in code. have commented out part

// $selector->daterange = new daterange(); // $selector->daterange->min = date('ymd', strtotime('2016/01/01')); // $selector->daterange->max = date('ymd', strtotime('2016/01/31')); 

because doesn't work. if uncomment part, code won't give me results. knowledge of how set date range bid landscapes in adwords api?

i have posted same question in google groups. how google adwords api team responded:

you cannot set date range bidlandscape. system calculation based on latest data, last 7 days, depending on data availability. bidlandscape similiar bid simulator in ui. can take @ thread discussed bidlandscape.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -