WC_Tracks_Client::send_batched_pixels
Send all queued pixels using batched non-blocking requests. This runs on the shutdown hook to batch all requests together.
Uses Requests library's request_multiple() for true parallel batching via curl_multi.
Method of the class: WC_Tracks_Client{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Tracks_Client::send_batched_pixels(): void;
Changelog
| Since 10.5.0 | Introduced. |
WC_Tracks_Client::send_batched_pixels() WC Tracks Client::send batched pixels code WC 10.7.0
public static function send_batched_pixels(): void {
if ( empty( self::$pixel_batch_queue ) ) {
return;
}
// Add request timestamp and nocache to all pixels.
$pixels_to_send = array();
foreach ( self::$pixel_batch_queue as $pixel ) {
$pixels_to_send[] = self::add_request_timestamp_and_nocache( $pixel );
}
// Send with Requests library for true parallel batching.
self::send_with_requests_multiple( $pixels_to_send );
// Clear the queue.
self::$pixel_batch_queue = array();
}