WC_Coupons_Tracking::tracks_coupons_events()publicWC 1.0

Track page view events.

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

Хуков нет.

Возвращает

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

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

$WC_Coupons_Tracking = new WC_Coupons_Tracking();
$WC_Coupons_Tracking->tracks_coupons_events();

Код WC_Coupons_Tracking::tracks_coupons_events() WC 8.7.0

public function tracks_coupons_events() {
	if ( isset( $_GET['post_type'] ) && 'shop_coupon' === $_GET['post_type'] ) {

		$this->tracks_coupons_bulk_actions();

		WC_Tracks::record_event(
			'coupons_view',
			array(
				'status' => isset( $_GET['post_status'] ) ? sanitize_text_field( wp_unslash( $_GET['post_status'] ) ) : 'all',
			)
		);

		if ( isset( $_GET['filter_action'] ) && 'Filter' === sanitize_text_field( wp_unslash( $_GET['filter_action'] ) ) && isset( $_GET['coupon_type'] ) ) {
			WC_Tracks::record_event(
				'coupons_filter',
				array(
					'filter' => 'coupon_type',
					'value'  => sanitize_text_field( wp_unslash( $_GET['coupon_type'] ) ),
				)
			);
		}

		if ( isset( $_GET['s'] ) && 0 < strlen( sanitize_text_field( wp_unslash( $_GET['s'] ) ) ) ) {
			WC_Tracks::record_event( 'coupons_search' );
		}
	}
}