From fc43bd24109741fe517baad3e594666b3bb05ac5 Mon Sep 17 00:00:00 2001 From: Gerhard Potgieter Date: Tue, 24 Apr 2018 12:42:06 +0200 Subject: [PATCH 1/2] Delay tracking request by 10 seconds to allow for page load to complete first. --- includes/class-wc-install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index 3ebd2e020e7..b3198a0230d 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -368,7 +368,7 @@ class WC_Install { wp_schedule_event( time(), 'daily', 'woocommerce_cleanup_orders' ); wp_schedule_event( time(), 'twicedaily', 'woocommerce_cleanup_sessions' ); wp_schedule_event( strtotime( 'first tuesday of next month' ), 'monthly', 'woocommerce_geoip_updater' ); - wp_schedule_event( time(), apply_filters( 'woocommerce_tracker_event_recurrence', 'daily' ), 'woocommerce_tracker_send_event' ); + wp_schedule_event( time() + 10, apply_filters( 'woocommerce_tracker_event_recurrence', 'daily' ), 'woocommerce_tracker_send_event' ); } /** From 07dcf77f6ff25727325f2db3e076bb7aa3bbc1bb Mon Sep 17 00:00:00 2001 From: Gerhard Potgieter Date: Tue, 24 Apr 2018 14:16:41 +0200 Subject: [PATCH 2/2] Deffer first tracker send to a cron instead of direct calling it. --- includes/admin/class-wc-admin-setup-wizard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/class-wc-admin-setup-wizard.php b/includes/admin/class-wc-admin-setup-wizard.php index 39514eb0c9c..5fa80ff7983 100644 --- a/includes/admin/class-wc-admin-setup-wizard.php +++ b/includes/admin/class-wc-admin-setup-wizard.php @@ -552,7 +552,7 @@ class WC_Admin_Setup_Wizard { if ( $tracking ) { update_option( 'woocommerce_allow_tracking', 'yes' ); - WC_Tracker::send_tracking_data( true ); + wp_schedule_single_event( time() + 10, 'woocommerce_tracker_send_event', array( true ) ); } else { update_option( 'woocommerce_allow_tracking', 'no' ); }