WPSEO_Tracking::should_send_tracking()protectedYoast 1.0

Determines whether to send the tracking data.

Returns false if tracking is disabled or the current page is one of the admin plugins pages. Returns true when there's no tracking data stored or the data was sent more than two weeks ago. The two weeks interval is set when instantiating the class.

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

Хуков нет.


true|false. True when tracking data should be sent.


// protected - в коде основоного (родительского) или дочернего класса
$result = $this->should_send_tracking( $ignore_time_treshhold );
Whether to send the tracking data ignoring the two weeks time treshhold.
По умолчанию: false

Код WPSEO_Tracking::should_send_tracking() Yoast 19.7.1

protected function should_send_tracking( $ignore_time_treshhold = false ) {
	global $pagenow;

	// Only send tracking on the main site of a multi-site instance. This returns true on non-multisite installs.
	if ( is_network_admin() || ! is_main_site() ) {
		return false;

	// Because we don't want to possibly block plugin actions with our routines.
	if ( in_array( $pagenow, [ 'plugins.php', 'plugin-install.php', 'plugin-editor.php' ], true ) ) {
		return false;

	$last_time = get_option( $this->option_name );

	// When tracking data haven't been sent yet or when sending data is forced.
	if ( ! $last_time || $ignore_time_treshhold ) {
		return true;

	return $this->exceeds_treshhold( $this->current_time - $last_time );