Remove Customer Order Count from Order Attribution checkout data (#44359)
* Remove Customer Order Count from Checkout Tracks data
This commit is contained in:
parent
a943de24fa
commit
cd7f429bc1
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: performance
|
||||||
|
|
||||||
|
Remove customer order count from order attribution checkout data.
|
|
@ -416,27 +416,25 @@ class OrderAttributionController implements RegisterHooksInterface {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function send_order_tracks( array $source_data, WC_Order $order ) {
|
private function send_order_tracks( array $source_data, WC_Order $order ) {
|
||||||
$origin_label = $this->get_origin_label(
|
$origin_label = $this->get_origin_label(
|
||||||
$source_data['source_type'] ?? '',
|
$source_data['source_type'] ?? '',
|
||||||
$source_data['utm_source'] ?? '',
|
$source_data['utm_source'] ?? '',
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
$customer_identifier = $order->get_customer_id() ? $order->get_customer_id() : $order->get_billing_email();
|
|
||||||
$customer_info = $this->get_customer_history( $customer_identifier );
|
$tracks_data = array(
|
||||||
$tracks_data = array(
|
'order_id' => $order->get_id(),
|
||||||
'order_id' => $order->get_id(),
|
'source_type' => $source_data['source_type'] ?? '',
|
||||||
'source_type' => $source_data['source_type'] ?? '',
|
'medium' => $source_data['utm_medium'] ?? '',
|
||||||
'medium' => $source_data['utm_medium'] ?? '',
|
'source' => $source_data['utm_source'] ?? '',
|
||||||
'source' => $source_data['utm_source'] ?? '',
|
'device_type' => strtolower( $source_data['device_type'] ?? 'unknown' ),
|
||||||
'device_type' => strtolower( $source_data['device_type'] ?? 'unknown' ),
|
'origin_label' => strtolower( $origin_label ),
|
||||||
'origin_label' => strtolower( $origin_label ),
|
'session_pages' => $source_data['session_pages'] ?? 0,
|
||||||
'session_pages' => $source_data['session_pages'] ?? 0,
|
'session_count' => $source_data['session_count'] ?? 0,
|
||||||
'session_count' => $source_data['session_count'] ?? 0,
|
'order_total' => $order->get_total(),
|
||||||
'order_total' => $order->get_total(),
|
'customer_registered' => $order->get_customer_id() ? 'yes' : 'no',
|
||||||
// Add 1 to include the current order (which is currently still Pending when the event is sent).
|
|
||||||
'customer_order_count' => $customer_info['order_count'] + 1,
|
|
||||||
'customer_registered' => $order->get_customer_id() ? 'yes' : 'no',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->proxy->call_static( WC_Tracks::class, 'record_event', 'order_attribution', $tracks_data );
|
$this->proxy->call_static( WC_Tracks::class, 'record_event', 'order_attribution', $tracks_data );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue