Automattic\WooCommerce\Internal\Admin

CustomerEffortScoreTracks::enable_survey_enqueing_if_tracking_is_enabled()privateWC 1.0

Add actions that require woocommerce_allow_tracking.

{} It's a method of the class: CustomerEffortScoreTracks{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->enable_survey_enqueing_if_tracking_is_enabled();

Code of CustomerEffortScoreTracks::enable_survey_enqueing_if_tracking_is_enabled() WC 7.1.0

private function enable_survey_enqueing_if_tracking_is_enabled() {
	// Only hook up the action handlers if in wp-admin.
	if ( ! is_admin() ) {
		return;
	}

	// Do not hook up the action handlers if a mobile device is used.
	if ( wp_is_mobile() ) {
		return;
	}

	// Only enqueue a survey if tracking is allowed.
	$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' );
	if ( ! $allow_tracking ) {
		return;
	}

	add_action( 'admin_init', array( $this, 'maybe_clear_ces_tracks_queue' ) );
	add_action( 'woocommerce_update_options', array( $this, 'run_on_update_options' ), 10, 3 );
	add_action( 'product_cat_add_form', array( $this, 'add_script_track_product_categories' ), 10, 3 );
	add_action( 'product_tag_add_form', array( $this, 'add_script_track_product_tags' ), 10, 3 );
	add_action( 'woocommerce_attribute_added', array( $this, 'run_on_add_product_attributes' ), 10, 3 );
	add_action( 'load-edit.php', array( $this, 'run_on_load_edit_php' ), 10, 3 );
	add_action( 'product_page_product_importer', array( $this, 'run_on_product_import' ), 10, 3 );
	// Only hook up the transition_post_status action handler
	// if on the edit page.
	global $pagenow;
	if ( 'post.php' === $pagenow ) {
		add_action(
			'transition_post_status',
			array(
				$this,
				'run_on_transition_post_status',
			),
			10,
			3
		);
	}
	$this->onsubmit_label = __( 'Thank you for your feedback!', 'woocommerce' );
}