Please, explain how it works paging in adwrods api, and how its works in get keywords idea service ?

35 views
Skip to first unread message

Александр Михайленко

unread,
Dec 13, 2017, 4:56:26 AM12/13/17
to AdWords API Forum
Hello, please explain me how use paging. Im try to get keywrods idea more than 700 items. I know what on onbe api call i get a 700 keywords, but i must get more.
i try to set a startindwex in 700,800 and other, but answer is null.
this is part of my code

$selector->setSearchParameters($searchParameters);
$selector->setPaging(new Paging(699, 700));
$page = $targetingIdeaService->get($selector);

$entries = $page->getEntries();
if ($entries !== null) {
    $totalNumEntries += $page->getTotalNumEntries();
    foreach ($entries as $targetingIdea) {
        $data = MapEntries::toAssociativeArray($targetingIdea->getData());
        $keyword = $data[AttributeType::KEYWORD_TEXT]->getValue();
        $searchVolume =
            ($data[AttributeType::SEARCH_VOLUME]->getValue() !== null)
                ? $data[AttributeType::SEARCH_VOLUME]->getValue() : 0;
        $averageCpc = $data[AttributeType::AVERAGE_CPC]->getValue();
        $competition = $data[AttributeType::COMPETITION]->getValue();
        $monthly = $data[AttributeType::TARGETED_MONTHLY_SEARCHES]->getValue();
        if(!empty($monthly) && is_array($monthly)) {
            $keyword_stats = array();
            foreach ($monthly as $month_stats) {
                $stats = new stdClass();
                $stats->year = $month_stats->getYear();
                $stats->month = $month_stats->getMonth();
                $stats->count = $month_stats->getCount();
                $keyword_stats[] = $stats;
            }
        }

        $keyword_obj = new  \stdClass();
        $keyword_obj->keyword = $keyword;
        $keyword_obj->search_volume = $searchVolume;
        $keyword_obj->average_CPC = ($averageCpc === null) ? 0 : number_format($averageCpc->getMicroAmount()/1000000,'2');
        $keyword_obj->competition = number_format($competition,'3');
        $keyword_obj->year_stats = $keyword_stats;

        $result_keyword['keywords'][] = $keyword_obj;
        unset($keyword_obj);
    }
    $result_keyword['count_data'] +=  $totalNumEntries;
}

Please, explain the algoritm of get more keywords items.
Thanks.

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Dec 13, 2017, 3:36:49 PM12/13/17
to AdWords API Forum
Hi, 

I am afraid, it is not possible to get more than 700 results for TargetingIdeaService.get(). Please check the guide on system limits for reference. You could also check the discussion on this forum thread. 

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