get_current_stats(); if ( isset( $stats[ $group_name ] ) && ! empty( $stats[ $group_name ] ) ) { return array( "x_woocommerce-{$group_name}" => implode( ',', $stats[ $group_name ] ) ); } return array(); } /** * Outputs the tracking pixels for the current stats and empty the stored stats from the object * * @return void */ public function do_stats() { if ( ! \WC_Site_Tracking::is_tracking_enabled() ) { return; } parent::do_stats(); } /** * Runs stats code for a one-off, server-side. * * @param string $url string The URL to be pinged. Should include `x_woocommerce-{$group}={$stats}` or whatever we want to store. * * @return bool If it worked. */ public function do_server_side_stat( $url ) { if ( ! \WC_Site_Tracking::is_tracking_enabled() ) { return false; } return parent::do_server_side_stat( $url ); } /** * Pings the stats server for the current stats and empty the stored stats from the object * * @return void */ public function do_server_side_stats() { if ( ! \WC_Site_Tracking::is_tracking_enabled() ) { return; } parent::do_server_side_stats(); } }