-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from farabi-deriv/farabi/bot-2289/update-all-…
…tracking-services Farabi/bot-2289/update-all-tracking-services
- Loading branch information
Showing
33 changed files
with
549 additions
and
216 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,31 @@ | ||
import { TFormValues } from '../pages/bot-builder/quick-strategy/types'; | ||
|
||
export const form_name = 'ce_bot_form'; | ||
export const STORED_ITEM_NOT_FOUND = 'No results found'; | ||
|
||
export enum ACTION { | ||
OPEN = 'open', | ||
CLOSE = 'close', | ||
RUN_BOT = 'run_bot', | ||
RUN_QUICK_STRATEGY = 'run_quick_strategy', | ||
EDIT_QUICK_STRATEGY = 'edit_quick_strategy', | ||
SELECT_QUICK_STRATEGY_GUIDE = 'select_quick_strategy_guide', | ||
SWITCH_QUICK_STRATEGY_TAB = 'switch_quick_strategy_tab', | ||
DASHBOARD_CLICK = 'dashboard_click', | ||
UPLOAD_STRATEGY_START = 'upload_strategy_start', | ||
UPLOAD_STRATEGY_COMPLETED = 'upload_strategy_completed', | ||
UPLOAD_STRATEGY_FAILED = 'upload_strategy_failed', | ||
GOOGLE_DRIVE_CONNECT = 'google_drive_connect', | ||
GOOGLE_DRIVE_DISCONNECT = 'google_drive_disconnect', | ||
SWITCH_LOAD_STRATEGY_TAB = 'switch_load_strategy_tab', | ||
ANNOUNCEMENT_CLICK = 'announcement_click', | ||
ANNOUNCEMENT_ACTION = 'announcement_action', | ||
} | ||
|
||
export type TFormStrategy = { | ||
form_values: TFormValues; | ||
} & TSelectedStrategy; | ||
|
||
export type TSelectedStrategy = { | ||
selected_strategy: string; | ||
}; |
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,12 @@ | ||
import { Analytics, TEvents } from '@deriv-com/analytics'; | ||
import { ACTION, form_name } from './constants'; | ||
|
||
export const rudderStackSendSwitchLoadStrategyTabEvent = ({ load_strategy_tab }: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.SWITCH_LOAD_STRATEGY_TAB, | ||
form_name, | ||
load_strategy_tab, | ||
subform_name: 'load_strategy', | ||
subpage_name: 'bot_builder', | ||
}); | ||
}; |
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,108 @@ | ||
import { Analytics, TEvents } from '@deriv-com/analytics'; | ||
import { ACTION, form_name, TFormStrategy } from './constants'; | ||
import { getRsStrategyType } from './utils'; | ||
|
||
export const rudderStackSendOpenEvent = ({ | ||
subpage_name, | ||
subform_source, | ||
subform_name, | ||
load_strategy_tab, | ||
}: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.OPEN, | ||
form_name, | ||
subpage_name, | ||
subform_name, | ||
subform_source, | ||
load_strategy_tab, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendCloseEvent = ({ | ||
subform_name, | ||
quick_strategy_tab, | ||
selected_strategy, | ||
load_strategy_tab, | ||
announcement_name, | ||
}: TEvents['ce_bot_form'] & TFormStrategy) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.CLOSE, | ||
form_name, | ||
subform_name, | ||
quick_strategy_tab, | ||
strategy_name: getRsStrategyType(selected_strategy), | ||
load_strategy_tab, | ||
announcement_name, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendRunBotEvent = ({ subpage_name }: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.RUN_BOT, | ||
form_name, | ||
subpage_name, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendUploadStrategyStartEvent = ({ upload_provider, upload_id }: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.UPLOAD_STRATEGY_START, | ||
form_name, | ||
subform_name: 'load_strategy', | ||
subpage_name: 'bot_builder', | ||
upload_provider, | ||
upload_id, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendUploadStrategyCompletedEvent = ({ | ||
upload_provider, | ||
upload_id, | ||
upload_type, | ||
}: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.UPLOAD_STRATEGY_COMPLETED, | ||
form_name, | ||
subform_name: 'load_strategy', | ||
subpage_name: 'bot_builder', | ||
upload_provider, | ||
upload_id, | ||
upload_type, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendUploadStrategyFailedEvent = ({ | ||
upload_provider, | ||
upload_id, | ||
upload_type, | ||
error_message, | ||
error_code, | ||
}: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.UPLOAD_STRATEGY_FAILED, | ||
form_name, | ||
subform_name: 'load_strategy', | ||
subpage_name: 'bot_builder', | ||
upload_provider, | ||
upload_id, | ||
upload_type, | ||
error_message, | ||
error_code, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendGoogleDriveConnectEvent = () => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.GOOGLE_DRIVE_CONNECT, | ||
form_name, | ||
subpage_name: 'bot_builder', | ||
}); | ||
}; | ||
|
||
export const rudderStackSendGoogleDriveDisconnectEvent = () => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.GOOGLE_DRIVE_DISCONNECT, | ||
form_name, | ||
subpage_name: 'bot_builder', | ||
}); | ||
}; |
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,35 @@ | ||
import { Analytics, TEvents } from '@deriv-com/analytics'; | ||
import { ACTION, form_name } from './constants'; | ||
|
||
export const rudderStackSendDashboardClickEvent = ({ dashboard_click_name, subpage_name }: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.DASHBOARD_CLICK, | ||
form_name, | ||
subpage_name, | ||
dashboard_click_name, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendAnnouncementClickEvent = ({ announcement_name }: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.ANNOUNCEMENT_CLICK, | ||
form_name, | ||
subform_name: 'announcements', | ||
subform_source: 'dashboard', | ||
announcement_name, | ||
}); | ||
}; | ||
|
||
export const rudderStackSendAnnouncementActionEvent = ({ | ||
announcement_name, | ||
announcement_action, | ||
}: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.ANNOUNCEMENT_ACTION, | ||
form_name, | ||
subform_name: 'announcements', | ||
subform_source: 'dashboard', | ||
announcement_name, | ||
announcement_action, | ||
}); | ||
}; |
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,38 @@ | ||
import { Analytics, TEvents } from '@deriv-com/analytics'; | ||
import { ACTION, form_name, type TFormStrategy } from './constants'; | ||
import { getRsStrategyType, getTradeParameterData } from './utils'; | ||
|
||
export const rudderStackSendQsRunStrategyEvent = ({ | ||
form_values, | ||
selected_strategy, | ||
}: TEvents['ce_bot_form'] & TFormStrategy) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.RUN_QUICK_STRATEGY, | ||
form_name, | ||
subform_name: 'quick_strategy', | ||
strategy_name: getRsStrategyType(selected_strategy), | ||
...getTradeParameterData({ form_values, selected_strategy }), | ||
}); | ||
}; | ||
|
||
export const rudderStackSendQsEditStrategyEvent = ({ | ||
form_values, | ||
selected_strategy, | ||
}: TEvents['ce_bot_form'] & TFormStrategy) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.EDIT_QUICK_STRATEGY, | ||
form_name, | ||
subform_name: 'quick_strategy', | ||
strategy_name: getRsStrategyType(selected_strategy), | ||
...getTradeParameterData({ form_values, selected_strategy }), | ||
}); | ||
}; | ||
|
||
export const rudderStackSendQsSelectedTabEvent = ({ quick_strategy_tab }: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.SWITCH_QUICK_STRATEGY_TAB, | ||
form_name, | ||
subform_name: 'quick_strategy', | ||
quick_strategy_tab, | ||
}); | ||
}; |
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,21 @@ | ||
import { Analytics, TEvents } from '@deriv-com/analytics'; | ||
import { ACTION, form_name, TSelectedStrategy } from './constants'; | ||
import { getRsStrategyType } from './utils'; | ||
|
||
export const rudderStackSendSelectQsStrategyGuideEvent = ({ selected_strategy }: TSelectedStrategy) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: ACTION.SELECT_QUICK_STRATEGY_GUIDE, | ||
form_name, | ||
subpage_name: 'tutorials', | ||
strategy_name: getRsStrategyType(selected_strategy), | ||
}); | ||
}; | ||
|
||
export const rudderStackSendTutorialSearchEvent = ({ search_term }: TEvents['ce_bot_form']) => { | ||
Analytics.trackEvent('ce_bot_form', { | ||
action: 'search', | ||
form_name: 'ce_bot_form', | ||
subpage_name: 'tutorials', | ||
search_term, | ||
}); | ||
}; |
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
Oops, something went wrong.