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

feat(analytics): add trade page events to rudderstack events #691

Merged
merged 3 commits into from
Jul 24, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class DerivRudderstackEvents {
);
}

/// --------- ce_virtual_signup_form ---------------
/// Captures app_open event when the app is opened.
void logAppOpened() {
DerivRudderstack().track(
Expand Down Expand Up @@ -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: <String, dynamic>{
'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: <String, dynamic>{
'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: <String, dynamic>{
'action': 'run_contract',
'form_name': 'ce_deriv_go_trade_form',
'market_name': market,
'chart_type_name': chartType,
'trade_type_name': tradeType,
'subform_name': currentPage,
});
}
}
Loading