WC_Tracks_Client::record_pixel_batched
Record a pixel using batched requests for improved performance. Pixels are queued and sent together on the shutdown hook.
Метод класса: WC_Tracks_Client{}
Хуки из метода
Возвращает
true|false. Always returns true.
Использование
$result = WC_Tracks_Client::record_pixel_batched( $pixel );
- $pixel(строка) (обязательный)
- pixel url and query string.
Список изменений
| С версии 10.5.0 | Введена. |
Код WC_Tracks_Client::record_pixel_batched() WC Tracks Client::record pixel batched WC 10.8.1
public static function record_pixel_batched( $pixel ) {
// Check if batching is enabled and supported.
$use_batching = self::can_use_batch_requests();
/**
* Filters whether to use batch requests for tracking pixels.
*
* @since 10.5.0
*
* @param bool $use_batching Whether to use batch requests. Default true if supported.
*/
$use_batching = apply_filters( 'wc_tracks_use_batch_requests', $use_batching );
if ( $use_batching ) {
// Queue the pixel and send on shutdown.
self::queue_pixel_for_batch( $pixel );
return true;
}
// Fallback to immediate sending if batching is not supported or disabled.
return self::record_pixel( $pixel );
}