-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c17029a
commit 858ad7e
Showing
6 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: add | ||
|
||
Add telemetry events from PRBs into ECE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { debounce } from 'lodash'; | ||
import { recordUserEvent } from 'tracks'; | ||
|
||
// Track the button click event. | ||
export const trackExpressCheckoutButtonClick = ( paymentMethod, source ) => { | ||
const expressPaymentTypeEvents = { | ||
google_pay: 'gpay_button_click', | ||
apple_pay: 'applepay_button_click', | ||
}; | ||
|
||
const event = expressPaymentTypeEvents[ paymentMethod ]; | ||
if ( ! event ) return; | ||
|
||
recordUserEvent( event, { source } ); | ||
}; | ||
|
||
// Track the button load event. | ||
export const trackExpressCheckoutButtonLoad = debounce( | ||
( { paymentMethods, source } ) => { | ||
const expressPaymentTypeEvents = { | ||
googlePay: 'gpay_button_load', | ||
applePay: 'applepay_button_load', | ||
}; | ||
|
||
for ( const paymentMethod of paymentMethods ) { | ||
const event = expressPaymentTypeEvents[ paymentMethod ]; | ||
if ( ! event ) continue; | ||
|
||
recordUserEvent( event, { source } ); | ||
} | ||
}, | ||
1000 | ||
); |