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