Hi,
I try to fetch the conversion-types from the ConversionTrackerService, but 
the TotalNumEntries is always limited to the given page-size. For example 
in my Test-Account I have 4 existing conversions. When i set the page-size 
to 1 the returned TotalNumEntries is also 1, with page-size 2 the 
TotalNumEntries is also 2, and so on. With a larger page-size than the 
actual number of existing conversions the returned TotalNumEntries is 
correct.

Im using the PHP api and based the following code on the "Get all 
campaigns" example code:

    public function getConversionTypes(): array
    {
        $pageSize = 2;

        $conversionTrackerService = 
$this->getService(ConversionTrackerService::class);

        $startIndex = 0;

        $selector = new Selector(['Id', 'Name']);
        $selector->setOrdering([new OrderBy('Name', SortOrder::ASCENDING)]);
        $selector->setPaging(new Paging($startIndex, $pageSize));

        $totalNumEntries = 0;
        $conversionTypes = [];
        do {
            $page = $conversionTrackerService->get($selector);

            if ($page->getEntries() !== null) {
                $totalNumEntries = $page->getTotalNumEntries();
                foreach ($page->getEntries() as $conversionType) {
                    $conversionTypes[] = $conversionType;
                }
            }

            $selector->getPaging()->setStartIndex(
                $selector->getPaging()->getStartIndex() + $pageSize
            );
        } while ($selector->getPaging()->getStartIndex() < 
$totalNumEntries);

        return $conversionTypes;
    }

Am I misunderstading the purpose of TotalNumEntries or is that a bug?

Regards,
Christopher

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/808bd545-6deb-4859-9f70-e85969221fcbn%40googlegroups.com.

Reply via email to