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

[CRO-880]/Agrim_Amina/fix binary userid #17673

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { Localize, localize } from '@deriv/translations';
import './add-options-account.scss';
import { useGrowthbookGetFeatureValue } from '@deriv/hooks';
import { useStore, observer } from '@deriv/stores';
import { isMobile, ContentFlag } from '@deriv/shared';
import { Analytics } from '@deriv-com/analytics';
import { isMobile, ContentFlag, cacheTrackEvents } from '@deriv/shared';

const AddOptions = observer(() => {
const { client, traders_hub, ui } = useStore();
Expand Down Expand Up @@ -37,12 +36,19 @@ const AddOptions = observer(() => {
has_effect
onClick={() => {
if (is_traders_dashboard_tracking_enabled) {
Analytics.trackEvent('ce_tradershub_dashboard_form', {
action: 'account_get',
form_name: 'traders_hub_default',
account_mode: selected_account_type,
account_name: 'cfd_banner',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_dashboard_form',
properties: {
action: 'account_get',
form_name: 'traders_hub_default',
account_mode: selected_account_type,
account_name: 'cfd_banner',
},
},
},
]);
}

if (is_real && eu_user) {
Expand Down
20 changes: 13 additions & 7 deletions packages/appstore/src/components/app-content.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useEffect } from 'react';
import { routes, WS } from '@deriv/shared';
import { routes, WS, cacheTrackEvents } from '@deriv/shared';
import { useGrowthbookGetFeatureValue } from '@deriv/hooks';
import { observer, useStore } from '@deriv/stores';
import { Analytics } from '@deriv-com/analytics';
import Routes from 'Components/routes/routes';
import classNames from 'classnames';
import './app.scss';
Expand Down Expand Up @@ -51,11 +50,18 @@ const AppContent: React.FC = observer(() => {
useEffect(() => {
if (selected_account_type) {
if (is_traders_dashboard_tracking_enabled) {
Analytics.trackEvent('ce_tradershub_dashboard_form', {
action: 'open',
form_name: 'traders_hub_default',
account_mode: selected_account_type,
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_dashboard_form',
properties: {
action: 'open',
form_name: 'traders_hub_default',
account_mode: selected_account_type,
},
},
},
]);
}
}
}, [selected_account_type]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useStore } from '@deriv/stores';
import { Analytics } from '@deriv-com/analytics';
import { SessionStore } from '@deriv/shared';
import { SessionStore, cacheTrackEvents } from '@deriv/shared';
import { getAllowedLanguages, Localize } from '@deriv/translations';
import { LabelPairedCircleChevronDownXlBoldIcon, LabelPairedXmarkLgBoldIcon } from '@deriv/quill-icons';
import { TEbooksUrl } from 'Components/banners/book-banner/book-banner';
Expand All @@ -23,10 +23,17 @@ const BookBannerTemplate = ({ e_book_show_way, e_books_url, e_book_from_landing,
};

React.useEffect(() => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'open',
...analytics_data,
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'open',
...analytics_data,
},
},
},
]);
}, []);

return (
Expand All @@ -45,10 +52,17 @@ const BookBannerTemplate = ({ e_book_show_way, e_books_url, e_book_from_landing,
target='_blank'
rel='noopener noreferrer'
onClick={() => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'click download',
...analytics_data,
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'click download',
...analytics_data,
},
},
},
]);
}}
>
<Localize i18n_default_text='Download e-book' />
Expand All @@ -68,10 +82,17 @@ const BookBannerTemplate = ({ e_book_show_way, e_books_url, e_book_from_landing,
height='24'
fill='var(--text-prominent)'
onClick={() => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'close',
...analytics_data,
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'close',
...analytics_data,
},
},
},
]);
SessionStore.remove('show_book');
setIsBannerShows(false);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Localize } from '@deriv/translations';
import { Button, Text, Icon } from '@deriv/components';
import { observer, useStore } from '@deriv/stores';
import { useCurrentCurrencyConfig } from '@deriv/hooks';
import { routes } from '@deriv/shared';
import { routes, cacheTrackEvents } from '@deriv/shared';
import './deposit-now-banner.scss';

const desktopWidth = 368;
Expand All @@ -23,20 +23,34 @@ const DepositNowBanner = observer(() => {
const { is_eu_user } = traders_hub;

const handleButtonClick = () => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'click_cta',
banner_name: 'first_deposit',
banner_type: 'with_cta',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'click_cta',
banner_name: 'first_deposit',
banner_type: 'with_cta',
},
},
},
]);
history.push(`${routes.cashier_deposit}${is_crypto_account ? '#deposit' : ''}`);
};

React.useEffect(() => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'open',
banner_name: 'first_deposit',
banner_type: 'with_cta',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'open',
banner_name: 'first_deposit',
banner_type: 'with_cta',
},
},
},
]);
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { useDevice } from '@deriv-com/ui';
import { getUrlBase, Jurisdiction } from '@deriv/shared';
import { getUrlBase, Jurisdiction, cacheTrackEvents } from '@deriv/shared';
import { Analytics } from '@deriv-com/analytics';
import { Localize } from '@deriv/translations';
import { Text, Button } from '@deriv/components';
Expand All @@ -14,20 +14,34 @@ const RealAccountCreationBanner = observer(() => {
const device = !isDesktop ? 'mobile' : 'desktop';

const handleClick = () => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'click_cta',
banner_name: 'real_account_cta',
banner_type: 'with_cta',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'click_cta',
banner_name: 'real_account_cta',
banner_type: 'with_cta',
},
},
},
]);
openRealAccountSignup(Jurisdiction.SVG);
};

useEffect(() => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'open',
banner_name: 'real_account_cta',
banner_type: 'with_cta',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'open',
banner_name: 'real_account_cta',
banner_type: 'with_cta',
},
},
},
]);
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ import { Icon, Text } from '@deriv/components';
import { observer, useStore } from '@deriv/stores';
import { Localize } from '@deriv/translations';
import { useDevice } from '@deriv-com/ui';
import { cacheTrackEvents } from '@deriv/shared';

const trackAnalyticsEvent = (
action: TEvents['ce_tradershub_banner']['action'],
account_mode: TEvents['ce_tradershub_banner']['account_mode']
) => {
Analytics.trackEvent('ce_tradershub_banner', {
action,
form_name: 'ce_tradershub_banner',
account_mode,
banner_name: 'setup_unsuccessful_wallets_step_3_2',
banner_type: 'with_cta',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action,
form_name: 'ce_tradershub_banner',
account_mode,
banner_name: 'setup_unsuccessful_wallets_step_3_2',
banner_type: 'with_cta',
},
},
},
]);
};

const WalletsBannerUnsuccessful = observer(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ import { Button, Icon, Text } from '@deriv/components';
import { observer, useStore } from '@deriv/stores';
import { Localize, localize } from '@deriv/translations';
import { useDevice } from '@deriv-com/ui';
import { cacheTrackEvents } from '@deriv/shared';

const trackAnalyticsEvent = (
action: TEvents['ce_tradershub_banner']['action'],
account_mode: TEvents['ce_tradershub_banner']['account_mode']
) => {
Analytics.trackEvent('ce_tradershub_banner', {
action,
form_name: 'ce_tradershub_banner',
account_mode,
banner_name: 'lets_go_wallets_step_1_2',
banner_type: 'with_cta',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action,
form_name: 'ce_tradershub_banner',
account_mode,
banner_name: 'lets_go_wallets_step_1_2',
banner_type: 'with_cta',
},
},
},
]);
};

type TProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Icon, Text } from '@deriv/components';
import { observer, useStore } from '@deriv/stores';
import { Localize } from '@deriv/translations';
import { useDevice } from '@deriv-com/ui';
import { cacheTrackEvents } from '@deriv/shared';

const WalletsBannerUpgrading = observer(() => {
const { traders_hub, common } = useStore();
Expand All @@ -30,13 +31,20 @@ const WalletsBannerUpgrading = observer(() => {
}

React.useEffect(() => {
Analytics.trackEvent('ce_tradershub_banner', {
action: 'open',
form_name: 'ce_tradershub_banner',
account_mode: is_demo ? 'demo' : 'real',
banner_name: 'setting_up_wallets_step_2',
banner_type: 'without_url',
});
cacheTrackEvents.loadEvent([
{
event: {
name: 'ce_tradershub_banner',
properties: {
action: 'open',
form_name: 'ce_tradershub_banner',
account_mode: is_demo ? 'demo' : 'real',
banner_name: 'setting_up_wallets_step_2',
banner_type: 'without_url',
},
},
},
]);
}, [is_demo]);

return (
Expand Down
Loading
Loading