class-wc-admin-setup-wizard-tracking.php
5 years ago
class-wc-coupon-tracking.php
6 years ago
class-wc-coupons-tracking.php
6 years ago
class-wc-extensions-tracking.php
6 years ago
class-wc-importer-tracking.php
6 years ago
class-wc-order-tracking.php
6 years ago
class-wc-orders-tracking.php
5 years ago
class-wc-products-tracking.php
5 years ago
class-wc-settings-tracking.php
5 years ago
class-wc-status-tracking.php
5 years ago
class-wc-status-tracking.php
49 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Status Tracking |
| 4 | * |
| 5 | * @package WooCommerce\Tracks |
| 6 | */ |
| 7 | |
| 8 | defined( 'ABSPATH' ) || exit; |
| 9 | |
| 10 | /** |
| 11 | * This class adds actions to track usage of WooCommerce Orders. |
| 12 | */ |
| 13 | class WC_Status_Tracking { |
| 14 | /** |
| 15 | * Init tracking. |
| 16 | */ |
| 17 | public function init() { |
| 18 | add_action( 'admin_init', array( $this, 'track_status_view' ), 10 ); |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Add Tracks events to the status page. |
| 23 | */ |
| 24 | public function track_status_view() { |
| 25 | if ( isset( $_GET['page'] ) && 'wc-status' === sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) { |
| 26 | |
| 27 | $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'status'; |
| 28 | |
| 29 | WC_Tracks::record_event( |
| 30 | 'status_view', |
| 31 | array( |
| 32 | 'tab' => $tab, |
| 33 | 'tool_used' => isset( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : null, |
| 34 | ) |
| 35 | ); |
| 36 | |
| 37 | if ( 'status' === $tab ) { |
| 38 | wc_enqueue_js( |
| 39 | " |
| 40 | $( 'a.debug-report' ).on( 'click', function() { |
| 41 | window.wcTracks.recordEvent( 'status_view_reports' ); |
| 42 | } ); |
| 43 | " |
| 44 | ); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 |