WPSEO_Tracking::send()publicYoast 1.0

Sends the tracking data.

Метод класса: WPSEO_Tracking{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPSEO_Tracking = new WPSEO_Tracking();
$WPSEO_Tracking->send( $force );
$force(true|false)
Whether to send the tracking data ignoring the two weeks time threshold.
По умолчанию: false

Код WPSEO_Tracking::send() Yoast 23.5

public function send( $force = false ) {
	if ( ! $this->should_send_tracking( $force ) ) {
		return;
	}

	// Set a 'content-type' header of 'application/json'.
	$tracking_request_args = [
		'headers' => [
			'content-type:' => 'application/json',
		],
	];

	$collector = $this->get_collector();

	$request = new WPSEO_Remote_Request( $this->endpoint, $tracking_request_args );
	$request->set_body( $collector->get_as_json() );
	$request->send();

	update_option( $this->option_name, $this->current_time, 'yes' );
}