ClickMeter’s APIs have a limit (100) on the number of datapoints that can be returned with a single request. This is a workaround to get the complete list, in case you have more than 100 datapoints.
Usage:
$pixels_list = array();
$offset = 0;
$output = api_request('http://apiv2.clickmeter.com/groups/' . $campaign_id . '/datapoints?type=TP&status=active', 'GET', NULL, $api_key);
while (!empty($output[entities])) {
foreach($output[entities] as $pixel) {
$pixels_list[] = $pixel;
}
$offset+= 100;
$output = api_request('http://apiv2.clickmeter.com/groups/' . $campaign_id . '/datapoints?offset=' . $offset . '&limit=100&type=TP&status=active', 'GET', NULL, $api_key);
}
This example shows how to get the complete list of tracking pixels for a specific campaign, with the active status.
Parameters:
-
offset: specify the index of the first datapoint that will be returned in the response.
-
limit: specify the maximum number of elements to retrieve. Default is 20, so we force the request to return 100 datapoints in order to reduce the number of requests.
Return value:
This snippet of code will produce an array called $pixels_list containing the complete list of datapoints.
0 Comments