Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Track event to the Pay For Order page #7538

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/add-pay-for-order-tracks
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Add pay-for-order Tracks events
8 changes: 4 additions & 4 deletions includes/class-wc-payments-woopay-button-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,14 @@ public function get_button_context() {
return 'cart';
}

if ( $this->is_checkout() ) {
return 'checkout';
}

if ( $this->is_pay_for_order_page() ) {
return 'pay_for_order';
}

if ( $this->is_checkout() ) {
return 'checkout';
}

return '';
}

Expand Down
10 changes: 10 additions & 0 deletions includes/class-woopay-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function __construct( $http ) {
add_action( 'woocommerce_checkout_order_processed', [ $this, 'checkout_order_processed' ] );
add_action( 'woocommerce_blocks_checkout_order_processed', [ $this, 'checkout_order_processed' ] );
add_action( 'woocommerce_payments_save_user_in_woopay', [ $this, 'must_save_payment_method_to_platform' ] );
add_action( 'before_woocommerce_pay_form', [ $this, 'pay_for_order_page_view' ] );
}

/**
Expand Down Expand Up @@ -423,6 +424,15 @@ public function classic_product_page_view() {
);
}

/**
* Record a Tracks event that the pay-for-order page has loaded.
*/
public function pay_for_order_page_view() {
$this->maybe_record_wcpay_shopper_event(
'pay_for_order_page_view'
);
}

/**
* Record a Tracks event that the order has been processed.
*/
Expand Down
Loading