From b9e2b098fb76ea4f8f5f633c062a6cd20f4db6f0 Mon Sep 17 00:00:00 2001 From: sahani-deriv <125638269+sahani-deriv@users.noreply.github.com> Date: Wed, 24 Jul 2024 14:23:28 +0800 Subject: [PATCH] feat(analytics): add trade page events to rudderstack events (#691) Co-authored-by: ramin-deriv <55975218+ramin-deriv@users.noreply.github.com> --- .../events/rudderstack_events.dart | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/packages/analytics/lib/sdk/rudderstack/events/rudderstack_events.dart b/packages/analytics/lib/sdk/rudderstack/events/rudderstack_events.dart index 1b2692f5b..9d7535fb2 100644 --- a/packages/analytics/lib/sdk/rudderstack/events/rudderstack_events.dart +++ b/packages/analytics/lib/sdk/rudderstack/events/rudderstack_events.dart @@ -13,6 +13,7 @@ class DerivRudderstackEvents { ); } + /// --------- ce_virtual_signup_form --------------- /// Captures app_open event when the app is opened. void logAppOpened() { DerivRudderstack().track( @@ -276,4 +277,75 @@ class DerivRudderstackEvents { }, ); } + + /// --------- ce_deriv_go_trade_form --------------- + /// Tracks when user opens trade page + /// + /// tradeType: Trade type name (e.g. 'Multipliers', 'Accumulators') + /// asset: Asset name (e.g. 'EURUSD', 'BTCUSD') + /// chartType: Chart type name (e.g. 'area', 'candle', 'worm') + /// actionTriggerType: Action trigger type (e.g. trade_page_cta, back_to_trade_page, assets_choice, trade_type_choice) + void logTradePageOpened({ + required String tradeType, + required String market, + required String chartType, + required String actionTriggerType, + }) { + DerivRudderstack().track( + eventName: 'ce_deriv_go_trade_form', + properties: { + 'action': 'open_trade_page', + 'form_name': 'ce_deriv_go_trade_form', + 'market_name': market, + 'trade_type_name': tradeType, + 'chart_type_name': chartType, + 'action_trigger_type': actionTriggerType, + }); + } + + /// Tracks when user opens big chart page + /// tradeType: Trade type name (e.g. 'Multipliers', 'Accumulators') + /// asset: Asset name (e.g. 'EURUSD', 'BTCUSD') + /// chartType: Chart type name (e.g. 'area', 'candle', 'worm') + /// actionTriggerType: Action trigger type (e.g. chart_double_click, bigchart_switcher_cta, chart_types_settings_cta) + void logBigChartPageOpened({ + required String tradeType, + required String market, + required String chartType, + required String actionTriggerType, + }) { + DerivRudderstack().track( + eventName: 'ce_deriv_go_trade_form', + properties: { + 'action': 'open_big_chart', + 'form_name': 'ce_deriv_go_trade_form', + 'market_name': market, + 'trade_type_name': tradeType, + 'chart_type_name': chartType, + 'action_trigger_type': actionTriggerType, + }); + } + + /// Tracks when user buys a contract + /// tradeType: Trade type name (e.g. 'Multipliers', 'Accumulators') + /// asset: Asset name (e.g. 'EURUSD', 'BTCUSD') + /// chartType: Chart type name (e.g. 'area', 'candle', 'worm') + /// currentPage: Current page name (e.g. 'trade_page', 'big_chart_page') + void logContractBought({ + required String market, + required String chartType, + required String tradeType, + required String currentPage, + }) { + DerivRudderstack().track( + eventName: 'ce_deriv_go_trade_form', + properties: { + 'action': 'run_contract', + 'form_name': 'ce_deriv_go_trade_form', + 'market_name': market, + 'chart_type_name': chartType, + 'trade_type_name': tradeType, + 'subform_name': currentPage, + }); + } }