'rocket_lcp_height_threshold'
);
if ( ! is_int( $width_threshold ) ) {
$width_threshold = $default_width_threshold;
}
if ( ! is_int( $height_threshold ) ) {
$height_threshold = $default_height_threshold;
}
$default_delay = 500;
/**
* Filters the delay before the beacon is triggered.
*
* @param int $delay The delay in milliseconds. Default is 500.
*/
$delay = rocket_apply_filter_and_deprecated(
'rocket_performance_hints_optimization_delay',
[ $default_delay ],
'3.16.4',
'rocket_lcp_delay'
);
if ( ! is_int( $delay ) ) {
$delay = $default_delay;
}
$data = [
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'rocket_beacon' ),
'url' => $url,
'is_mobile' => $is_mobile,
'width_threshold' => $width_threshold,
'height_threshold' => $height_threshold,
'delay' => $delay,
'debug' => rocket_get_constant( 'WP_ROCKET_DEBUG' ),
'status' => [],
];
$data_modified = null;
foreach ( $this->factories as $factory ) {
$data = $data_modified ?? $data;
$data_modified = $factory->get_frontend_controller()->add_custom_data( $data );
}
$inline_script = '';
// Get the URL of the script.
$script_url = rocket_get_constant( 'WP_ROCKET_ASSETS_JS_URL' ) . 'wpr-beacon' . $min . '.js';
// Create the script tag.
$script_tag = ""; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
// Append the script tag just before the closing body tag.
return str_replace( '