diff --git a/src/CONST/index.ts b/src/CONST/index.ts index f2d66c6656c65..3164308ec71fb 100644 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -8227,6 +8227,9 @@ const CONST = { SIGN_UP: 'sign_up', WORKSPACE_CREATED: 'workspace_created', PAID_ADOPTION: 'paid_adoption', + PRODUCT_TRAINING_SCAN_TEST_TOOLTIP_SHOWN: 'product_training_scan_test_tooltip_shown', + PRODUCT_TRAINING_SCAN_TEST_TOOLTIP_DISMISSED: 'product_training_scan_test_tooltip_dismissed', + PRODUCT_TRAINING_SCAN_TEST_TOOLTIP_CONFIRMED: 'product_training_scan_test_tooltip_confirmed', }, }, diff --git a/src/components/ProductTrainingContext/index.tsx b/src/components/ProductTrainingContext/index.tsx index 36d09312c6eb4..d3b63e9d1fd3d 100644 --- a/src/components/ProductTrainingContext/index.tsx +++ b/src/components/ProductTrainingContext/index.tsx @@ -41,6 +41,11 @@ type ProductTrainingContextConfig = { * Callback to be called when the tooltip is confirmed */ onConfirm?: () => void; + + /** + * Callback to be called when the tooltip is shown + */ + onShown?: () => void; }; const ProductTrainingContext = createContext({ @@ -268,8 +273,12 @@ const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shou const renderProductTrainingTooltip = useCallback(() => { const tooltip = TOOLTIPS[tooltipName]; + return ( - + { + GoogleTagManager.publishEvent(CONST.ANALYTICS.EVENT.PRODUCT_TRAINING_SCAN_TEST_TOOLTIP_SHOWN, accountID); + }, onConfirm: () => { setTestReceiptAndNavigateRef?.current?.(); + GoogleTagManager.publishEvent(CONST.ANALYTICS.EVENT.PRODUCT_TRAINING_SCAN_TEST_TOOLTIP_CONFIRMED, accountID); }, onDismiss: () => { dismissProductTraining(CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP, true); + GoogleTagManager.publishEvent(CONST.ANALYTICS.EVENT.PRODUCT_TRAINING_SCAN_TEST_TOOLTIP_DISMISSED, accountID); }, }, );