Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

[CRO] NikitK/CRO-380/tracking issues for partners signup #6363

Merged
3 changes: 1 addition & 2 deletions crowdin/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4256,8 +4256,7 @@
"-1049534775": "Please enter a valid postcode with Latin characters.",
"-420140433": "Company registration number is required",
"-1857429287": "Last Name",
"-706927392": "Important Guidelines",
"-2086585870": "Partners Guide",
"-1702877392": "Important guidelines",
"-776458472": "General terms of use",
"-2083825503": "Affiliates & introducing brokers (IBs)",
"-28284335": "Additional terms for our affiliates and introducing brokers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,23 @@ const WizardFooter = ({
}: WizardComponentTypes) => {
const buttonHandler = React.useCallback(
(button_type: ButtonType): void => {
const prev_step = step - 1
NikitK-deriv marked this conversation as resolved.
Show resolved Hide resolved
if (button_type === ButtonType.Previous) {
trackEvent({
action: 'step_back',
step_num: step,
step_codename: getCodeName(step),
step_num: prev_step,
step_codename: getCodeName(prev_step),
})
step > 1 && setStep(step - 1)
step > 1 && setStep(prev_step)
}
if (button_type === ButtonType.Next) {
const next_step = step + 1
trackEvent({
action: 'step_passed',
step_num: step,
step_codename: getCodeName(step),
step_num: next_step,
step_codename: getCodeName(next_step),
})
step < max_step && setStep(step + 1)
step < max_step && setStep(next_step)
}
},
[max_step, setStep, step],
Expand Down
12 changes: 11 additions & 1 deletion src/pages/signup-affiliates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const ParentWrapper = styled.div`
background-image: url(${Map});
background-repeat: no-repeat;
background-position: bottom;

@media ${device.tabletL} {
background-image: unset;
}
`
const StyledContainer = styled(Container)`
display: flex;
Expand Down Expand Up @@ -86,7 +90,13 @@ const AffiliateSignup = () => {

useEffect(() => {
trackEvent({ action: 'open' })
return () => trackEvent({ action: 'close' })
const handleBeforeUnload = (event) => {
event.preventDefault()
event.returnValue = 'Are you sure you want to leave this page?'
NikitK-deriv marked this conversation as resolved.
Show resolved Hide resolved
trackEvent({ action: 'close' })
}
window.addEventListener('beforeunload', handleBeforeUnload)
return () => window.removeEventListener('beforeunload', handleBeforeUnload)
NikitK-deriv marked this conversation as resolved.
Show resolved Hide resolved
}, [])

useEffect(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/signup-affiliates/utils/_tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const trackEvent = ({
}: TEvents['ce_partner_account_signup_form']) => {
Analytics?.trackEvent('ce_partner_account_signup_form', {
action,
partner_signup_error_message,
user_choice,
step_num,
step_codename,
form_name: 'ce_partner_account_signup_form',
...(user_choice && { user_choice }),
...(step_num && { step_num }),
...(step_codename && { step_codename }),
...(partner_signup_error_message && { partner_signup_error_message }),
})
}
export default trackEvent
Loading