How to set date range in Bid Landscapes - Adwords API

210 views
Skip to first unread message

Kanan Farzali

unread,
Feb 8, 2016, 6:28:31 AM2/8/16
to AdWords API Forum

I am playing with Bid Landscapes, and as the official documentation describes:

Bid landscapes are a way for you to research information about estimated performance for your ad groups and criteria.

I am testing the API in AdGroup level, and the 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'));

    do {
        // Make the getAdGroupBidLandscape request.
        $page = $dataService->getAdGroupBidLandscape($selector);

        // Display results.
        if (isset($page->entries)) {
            foreach ($page->entries as $bidLandscape) {
                printf("Found adgroup bid landscape with id '%s' for start "
                        . "date '%s', end date '%s', and landscape points:\n",
                        $bidLandscape->adGroupId,
                        $bidLandscape->startDate,
                        $bidLandscape->endDate);
                foreach ($bidLandscape->landscapePoints as $bidLandscapePoint) {
                    printf("  bid: %.0f => clicks: %d, cost: %.0f, impressions: %d\n", 
                            $bidLandscapePoint->bid->microAmount, 
                            $bidLandscapePoint->clicks, 
                            $bidLandscapePoint->cost->microAmount, 
                            $bidLandscapePoint->impressions);
                }
                print "\n";
            }
        }
        // Advance the 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 were found.\n";
    }
}

This code works fine, and the output is similar to:

Found adgroup bid landscape with id '****' for start date   '20160131', end date '20160206', and 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 with id '****' for start date '20160131', end date '20160206', and 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, the API always picks up the previous week range ending two days from now. For instance, if today is 2016/02/08, the API will get the range between 2016/01/31 and 2016/02/06. My problem is how to set the specific date range in the code. I have commented out this part

// $selector->dateRange = new DateRange();
// $selector->dateRange->min = date('Ymd', strtotime('2016/01/01'));
// $selector->dateRange->max = date('Ymd', strtotime('2016/01/31'));

because it doesn't work. If I uncomment this part, the code won't give me any results. Any knowledge of how to set a date range for the bid landscapes in Adwords API?

Yin Niu

unread,
Feb 8, 2016, 12:14:06 PM2/8/16
to AdWords API Forum
Hello, 

You cannot set date range for BidLandScape. The system does the calculation based on the latest data, generally last 7 days, depending on data availability. BidLandscape is similiar to the Bid Simulator in UI. You can take a look at this thread which discussed about BidLandScape. 

Thanks,
Yin, AdWords API Team. 

Yang Gao

unread,
Dec 29, 2017, 3:52:16 AM12/29/17
to AdWords API Forum
Also trying to use the landscapes and note that for the most part, the returned date range is for a week from 9 days ago to 2 days ago, from today. However, there are some with different ranges, even for high trafficking keywords, e.g. from say 10 days ago to 3 days ago. Is there a reason for the difference?

There are a few (not many) with a shorter duration between start and end dates. In these cases, how should I interpret the metrics? Are those scaled out to represent what we should expect for a full week? Or are those just what we should expect for the days shown? If so, how can we account for differences in weekends vs weekdays?

Thanks!

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 2, 2018, 12:06:09 PM1/2/18
to AdWords API Forum
Hi Yang, 

Ideally, the API results for Bid Landscapes should be comparable with the Bid Simulator. Could you also try the bid simulator for these criterion and see if the results are comparable? If not, could you give some samples in your account (criteria id, AdGroup, Campaign and the client customer Id) where you have different Date ranges (10 days ago to 3 days ago, shorter range)? Please use reply privately to author while sharing the details.

The results will always correspond to what you should expect for the given days with the modified bids. You could perhaps try the request in such a way that the date range will include a few weekdays and weekends which will help you compare between these two.

Thanks,
Sreelakshmi, AdWords API Team
Reply all
Reply to author
Forward
0 new messages