2019-02-28 03:28:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* WooCommerce Admin Setup Wizard Tracking
|
|
|
|
*
|
|
|
|
* @package WooCommerce\Tracks
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 03:28:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class adds actions to track usage of the WooCommerce Onboarding Wizard.
|
|
|
|
*/
|
|
|
|
class WC_Admin_Setup_Wizard_Tracking {
|
2019-03-01 02:58:11 +00:00
|
|
|
/**
|
|
|
|
* Steps for the setup wizard
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
private $steps = array();
|
|
|
|
|
2019-02-28 03:28:07 +00:00
|
|
|
/**
|
|
|
|
* Init tracking.
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 03:28:07 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function init() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 03:28:07 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 09:54:07 +00:00
|
|
|
/**
|
|
|
|
* Get the name of the current step.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 09:54:07 +00:00
|
|
|
* @return string
|
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function get_current_step() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-12-13 19:58:14 +00:00
|
|
|
return isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
2019-02-28 09:54:07 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 09:41:15 +00:00
|
|
|
/**
|
2019-04-17 12:54:59 +00:00
|
|
|
* Add footer scripts to OBW via woocommerce_setup_footer
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 09:41:15 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function add_footer_scripts() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 09:41:15 +00:00
|
|
|
}
|
|
|
|
|
2019-03-01 03:24:02 +00:00
|
|
|
/**
|
|
|
|
* Dequeue unwanted scripts from OBW footer.
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-03-01 03:24:02 +00:00
|
|
|
*/
|
2020-08-25 21:03:03 +00:00
|
|
|
public function dequeue_non_allowed_scripts() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-03-01 03:24:02 +00:00
|
|
|
global $wp_scripts;
|
2020-08-25 21:03:03 +00:00
|
|
|
$allowed = array( 'woo-tracks' );
|
2019-03-01 03:24:02 +00:00
|
|
|
|
|
|
|
foreach ( $wp_scripts->queue as $script ) {
|
2020-08-25 21:03:03 +00:00
|
|
|
if ( in_array( $script, $allowed, true ) ) {
|
2019-03-01 03:24:02 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
wp_dequeue_script( $script );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-01 03:12:30 +00:00
|
|
|
/**
|
|
|
|
* Track when tracking is opted into and OBW has started.
|
|
|
|
*
|
|
|
|
* @param string $option Option name.
|
|
|
|
* @param string $value Option value.
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-03-01 03:12:30 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function track_start( $option, $value ) {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-03-01 03:12:30 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 09:42:38 +00:00
|
|
|
/**
|
|
|
|
* Track the marketing form on submit.
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 09:42:38 +00:00
|
|
|
*/
|
2019-02-28 09:41:15 +00:00
|
|
|
public function track_ready_next_steps() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 09:42:38 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 03:28:07 +00:00
|
|
|
/**
|
|
|
|
* Track various events when a step is saved.
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 03:28:07 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function add_step_save_events() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 03:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Track store setup and store properties on save.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 03:28:07 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function track_store_setup() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 03:28:07 +00:00
|
|
|
}
|
2019-02-28 03:58:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Track payment gateways selected.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 03:58:08 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function track_payments() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 03:58:08 +00:00
|
|
|
}
|
2019-02-28 06:22:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Track shipping units and whether or not labels are set.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 06:22:13 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function track_shipping() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 06:22:13 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 06:27:05 +00:00
|
|
|
/**
|
|
|
|
* Track recommended plugins selected for install.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 06:27:05 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function track_recommended() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 06:27:05 +00:00
|
|
|
}
|
2019-02-28 06:33:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tracks when Jetpack is activated through the OBW.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-02-28 06:33:00 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function track_jetpack_activate() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-02-28 06:33:00 +00:00
|
|
|
}
|
2019-03-01 02:58:11 +00:00
|
|
|
|
2019-07-02 21:56:08 +00:00
|
|
|
/**
|
|
|
|
* Tracks when last next_steps screen is viewed in the OBW.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-07-02 21:56:08 +00:00
|
|
|
*/
|
|
|
|
public function track_next_steps() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-07-02 21:56:08 +00:00
|
|
|
}
|
|
|
|
|
2019-03-01 02:58:11 +00:00
|
|
|
/**
|
|
|
|
* Track skipped steps.
|
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-03-01 02:58:11 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function track_skip_step() {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-03-01 02:58:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the OBW steps inside this class instance.
|
|
|
|
*
|
|
|
|
* @param array $steps Array of OBW steps.
|
2020-06-23 18:29:58 +00:00
|
|
|
*
|
2020-08-13 17:46:12 +00:00
|
|
|
* @deprecated 4.5.0
|
2019-03-01 02:58:11 +00:00
|
|
|
*/
|
2019-03-05 00:30:01 +00:00
|
|
|
public function set_obw_steps( $steps ) {
|
2020-08-13 17:46:12 +00:00
|
|
|
_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.5.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) );
|
2019-03-05 00:30:01 +00:00
|
|
|
$this->steps = $steps;
|
2019-03-01 02:58:11 +00:00
|
|
|
|
|
|
|
return $steps;
|
|
|
|
}
|
2019-02-28 03:28:07 +00:00
|
|
|
}
|