diff --git a/includes/admin/class-wc-admin-addons.php b/includes/admin/class-wc-admin-addons.php index a01784abc1b..524f63d9d9e 100644 --- a/includes/admin/class-wc-admin-addons.php +++ b/includes/admin/class-wc-admin-addons.php @@ -704,7 +704,9 @@ class WC_Admin_Addons { 'repo-slug' => 'woocommerce-payments', ); - WC_Install::background_installer( $services_plugin_id, $wcpay_plugin ); + WC_Install::background_installer( $wcpay_plugin_id, $wcpay_plugin ); + + do_action( 'wc_addons_woocommerce_payments_installed' ); wp_safe_redirect( remove_query_arg( array( 'install-addon', '_wpnonce' ) ) ); exit; diff --git a/includes/tracks/events/class-wc-extensions-tracking.php b/includes/tracks/events/class-wc-extensions-tracking.php index 70f582b4b06..34c5b4868e1 100644 --- a/includes/tracks/events/class-wc-extensions-tracking.php +++ b/includes/tracks/events/class-wc-extensions-tracking.php @@ -21,6 +21,7 @@ class WC_Extensions_Tracking { add_action( 'woocommerce_helper_connected', array( $this, 'track_helper_connection_complete' ) ); add_action( 'woocommerce_helper_disconnected', array( $this, 'track_helper_disconnected' ) ); add_action( 'woocommerce_helper_subscriptions_refresh', array( $this, 'track_helper_subscriptions_refresh' ) ); + add_action( 'wc_addons_woocommerce_payments_installed', array( $this, 'track_woocommerce_payments_install' ) ); } /** @@ -76,4 +77,14 @@ class WC_Extensions_Tracking { public function track_helper_subscriptions_refresh() { WC_Tracks::record_event( 'extensions_subscriptions_update' ); } + + /** + * Send a Tracks event when WooCommerce Payments is installed from the Extensions page. + */ + public function track_woocommerce_payments_install() { + + $properties = array( 'context' => 'extensions' ); + + WC_Tracks::record_event( 'woocommerce_payments_install', $properties ); + } }