WC_Products_Tracking::possibly_add_product_tracking_scripts()publicWC 1.0

Adds the tracking scripts for product filtering actions.

Method of the class: WC_Products_Tracking{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Products_Tracking = new WC_Products_Tracking();
$WC_Products_Tracking->possibly_add_product_tracking_scripts( $hook );
$hook(string) (required)
Page hook.

WC_Products_Tracking::possibly_add_product_tracking_scripts() code WC 9.3.1

public function possibly_add_product_tracking_scripts( $hook ) {
	$product_screen = $this->get_product_screen( $hook );
	if ( ! $product_screen ) {
		return;
	}

	WCAdminAssets::register_script( 'wp-admin-scripts', 'product-tracking', false );
	wp_localize_script(
		'wc-admin-product-tracking',
		'productScreen',
		array(
			'name' => $product_screen,
		)
	);
}