From 3472c0bc6a5fb4b16178eae9bab6c3f4f17b2beb Mon Sep 17 00:00:00 2001 From: anthony2399 Date: Wed, 11 Dec 2024 14:25:31 +0200 Subject: [PATCH] feat: added analytics for console --- .../claimSection/ens-by-api-key-called.ts | 3 ++ .../analytics/events/claimSection/index.ts | 12 +++++++ apps/console/src/analytics/events/index.ts | 11 +++++- .../navigation/dashboard-link-clicked.ts | 3 ++ .../src/analytics/events/navigation/index.ts | 6 ++++ .../src/analytics/events/network/index.ts | 9 +++++ .../events/network/network-changed.ts | 5 +++ .../analytics/events/plugins/efp-disabled.ts | 3 ++ .../src/analytics/events/plugins/index.ts | 34 +++++++++++++++++-- .../events/plugins/just-verified-disabled.ts | 3 ++ .../plugins/justVerified/discord-disabled.ts | 3 ++ .../plugins/justVerified/email-disabled.ts | 3 ++ .../plugins/justVerified/github-disabled.ts | 3 ++ .../events/plugins/justVerified/index.ts | 18 ++++++++++ .../plugins/justVerified/telegram-disabled.ts | 3 ++ .../plugins/justVerified/twitter-disabled.ts | 3 ++ .../analytics/events/plugins/poap-disabled.ts | 3 ++ .../plugins/talent-protocol-disabled.ts | 3 ++ .../events/plugins/talent-protocol-enabled.ts | 3 ++ .../analytics/events/plugins/xmtp-disabled.ts | 3 ++ .../analytics/events/plugins/xmtp-enabled.ts | 3 ++ .../events/signSection/any-ens-selected.ts | 3 ++ .../signSection/claimable-ens-selected.ts | 3 ++ .../src/analytics/events/signSection/index.ts | 21 ++++++++++++ .../signSection/specific-ens-selected.ts | 5 +++ apps/console/src/app/page.tsx | 2 +- .../customizer/ClaimSection/index.tsx | 26 ++++++++------ .../sections/customizer/Customizer/index.tsx | 9 +++-- .../customizer/PluginsSection/EFP/index.tsx | 1 + .../PluginsSection/JustVerified/index.tsx | 16 +++++---- .../customizer/PluginsSection/POAP/index.tsx | 1 + .../PluginsSection/TalentProtocol/index.tsx | 3 ++ .../customizer/PluginsSection/XMTP/index.tsx | 7 ++-- .../sections/customizer/SignSection/index.tsx | 12 +++++++ 34 files changed, 219 insertions(+), 27 deletions(-) create mode 100644 apps/console/src/analytics/events/claimSection/ens-by-api-key-called.ts create mode 100644 apps/console/src/analytics/events/claimSection/index.ts create mode 100644 apps/console/src/analytics/events/navigation/dashboard-link-clicked.ts create mode 100644 apps/console/src/analytics/events/network/index.ts create mode 100644 apps/console/src/analytics/events/network/network-changed.ts create mode 100644 apps/console/src/analytics/events/plugins/efp-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/just-verified-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/justVerified/discord-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/justVerified/email-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/justVerified/github-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/justVerified/telegram-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/justVerified/twitter-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/poap-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/talent-protocol-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/talent-protocol-enabled.ts create mode 100644 apps/console/src/analytics/events/plugins/xmtp-disabled.ts create mode 100644 apps/console/src/analytics/events/plugins/xmtp-enabled.ts create mode 100644 apps/console/src/analytics/events/signSection/any-ens-selected.ts create mode 100644 apps/console/src/analytics/events/signSection/claimable-ens-selected.ts create mode 100644 apps/console/src/analytics/events/signSection/index.ts create mode 100644 apps/console/src/analytics/events/signSection/specific-ens-selected.ts diff --git a/apps/console/src/analytics/events/claimSection/ens-by-api-key-called.ts b/apps/console/src/analytics/events/claimSection/ens-by-api-key-called.ts new file mode 100644 index 00000000..8508bebe --- /dev/null +++ b/apps/console/src/analytics/events/claimSection/ens-by-api-key-called.ts @@ -0,0 +1,3 @@ +export const ENS_BY_API_KEY_CALLED = 'ENS_BY_API_KEY_CALLED'; + +export interface EnsByApiKeyCalledPayload {} diff --git a/apps/console/src/analytics/events/claimSection/index.ts b/apps/console/src/analytics/events/claimSection/index.ts new file mode 100644 index 00000000..82ffc976 --- /dev/null +++ b/apps/console/src/analytics/events/claimSection/index.ts @@ -0,0 +1,12 @@ +import { + ENS_BY_API_KEY_CALLED, + EnsByApiKeyCalledPayload, +} from './ens-by-api-key-called'; + +export const CLAIM_SECTION_EVENTS = { + ENS_BY_API_KEY_CALLED, +} as const; + +export interface ClaimSectionEventPayload { + [ENS_BY_API_KEY_CALLED]: EnsByApiKeyCalledPayload; +} diff --git a/apps/console/src/analytics/events/index.ts b/apps/console/src/analytics/events/index.ts index 0fd621a8..b377c09c 100644 --- a/apps/console/src/analytics/events/index.ts +++ b/apps/console/src/analytics/events/index.ts @@ -1,17 +1,26 @@ import { AUTH_EVENTS, AuthEventPayload } from './auth'; +import { CLAIM_SECTION_EVENTS, ClaimSectionEventPayload } from './claimSection'; import { CODE_EVENTS, CodeEventPayload } from './code'; import { NAVIGATION_EVENTS, NavigationEventPayload } from './navigation'; +import { NETWORK_EVENTS, NetworkEventPayload } from './network'; import { PLUGINS_EVENTS, PluginsEventPayload } from './plugins'; +import { SIGN_SECTION_EVENTS, SignSectionEventPayload } from './signSection'; export const EVENTS = { ...AUTH_EVENTS, + ...CLAIM_SECTION_EVENTS, ...CODE_EVENTS, ...NAVIGATION_EVENTS, + ...NETWORK_EVENTS, ...PLUGINS_EVENTS, + ...SIGN_SECTION_EVENTS, } as const; export interface EventPayload extends CodeEventPayload, NavigationEventPayload, PluginsEventPayload, - AuthEventPayload {} + AuthEventPayload, + NetworkEventPayload, + ClaimSectionEventPayload, + SignSectionEventPayload {} diff --git a/apps/console/src/analytics/events/navigation/dashboard-link-clicked.ts b/apps/console/src/analytics/events/navigation/dashboard-link-clicked.ts new file mode 100644 index 00000000..8fdbd749 --- /dev/null +++ b/apps/console/src/analytics/events/navigation/dashboard-link-clicked.ts @@ -0,0 +1,3 @@ +export const DASHBOARD_LINK_CLICKED = 'DASHBOARD_LINK_CLICKED'; + +export interface DashboardLinkClickedPayload {} diff --git a/apps/console/src/analytics/events/navigation/index.ts b/apps/console/src/analytics/events/navigation/index.ts index a853787c..bc695925 100644 --- a/apps/console/src/analytics/events/navigation/index.ts +++ b/apps/console/src/analytics/events/navigation/index.ts @@ -1,12 +1,18 @@ +import { + DASHBOARD_LINK_CLICKED, + DashboardLinkClickedPayload, +} from './dashboard-link-clicked'; import { DOCS_LINK_CLICKED, DocsLinkClickedPayload } from './docs-link-clicked'; import { PROFILE_VIEWED, ProfileViewedPayload } from './profile-viewed'; export const NAVIGATION_EVENTS = { DOCS_LINK_CLICKED, PROFILE_VIEWED, + DASHBOARD_LINK_CLICKED, } as const; export interface NavigationEventPayload { [DOCS_LINK_CLICKED]: DocsLinkClickedPayload; [PROFILE_VIEWED]: ProfileViewedPayload; + [DASHBOARD_LINK_CLICKED]: DashboardLinkClickedPayload; } diff --git a/apps/console/src/analytics/events/network/index.ts b/apps/console/src/analytics/events/network/index.ts new file mode 100644 index 00000000..3c751704 --- /dev/null +++ b/apps/console/src/analytics/events/network/index.ts @@ -0,0 +1,9 @@ +import { NETWORK_CHANGED, NetworkChangedPayload } from './network-changed'; + +export const NETWORK_EVENTS = { + NETWORK_CHANGED, +} as const; + +export interface NetworkEventPayload { + [NETWORK_CHANGED]: NetworkChangedPayload; +} diff --git a/apps/console/src/analytics/events/network/network-changed.ts b/apps/console/src/analytics/events/network/network-changed.ts new file mode 100644 index 00000000..6af14f5e --- /dev/null +++ b/apps/console/src/analytics/events/network/network-changed.ts @@ -0,0 +1,5 @@ +export const NETWORK_CHANGED = 'NETWORK_CHANGED'; + +export interface NetworkChangedPayload { + chainId: number; +} diff --git a/apps/console/src/analytics/events/plugins/efp-disabled.ts b/apps/console/src/analytics/events/plugins/efp-disabled.ts new file mode 100644 index 00000000..adc5b174 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/efp-disabled.ts @@ -0,0 +1,3 @@ +export const EFP_DISABLED = 'EFP_DISABLED'; + +export interface EfpDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/index.ts b/apps/console/src/analytics/events/plugins/index.ts index 058fbdd1..86427f00 100644 --- a/apps/console/src/analytics/events/plugins/index.ts +++ b/apps/console/src/analytics/events/plugins/index.ts @@ -1,23 +1,53 @@ +import { EFP_DISABLED, EfpDisabledPayload } from './efp-disabled'; +import { EFP_ENABLED, EfpEnabledPayload } from './efp-enabled'; +import { + JUST_VERIFIED_DISABLED, + JustVerifiedDisabledPayload, +} from './just-verified-disabled'; import { JUST_VERIFIED_ENABLED, JustVerifiedEnabledPayload, } from './just-verified-enabled'; -import { EFP_ENABLED, EfpEnabledPayload } from './efp-enabled'; -import { POAP_ENABLED, PoapEnabledPayload } from './poap-enabled'; import { JUST_VERIFIED_EVENTS, JustVerifiedEventsPayload, } from './justVerified'; +import { POAP_DISABLED, PoapDisabledPayload } from './poap-disabled'; +import { POAP_ENABLED, PoapEnabledPayload } from './poap-enabled'; +import { + TALENT_PROTOCOL_DISABLED, + TalentProtocolDisabledPayload, +} from './talent-protocol-disabled'; +import { + TALENT_PROTOCOL_ENABLED, + TalentProtocolEnabledPayload, +} from './talent-protocol-enabled'; +import { XMTP_DISABLED, XmtpDisabledPayload } from './xmtp-disabled'; +import { XMTP_ENABLED, XmtpEnabledPayload } from './xmtp-enabled'; export const PLUGINS_EVENTS = { + JUST_VERIFIED_DISABLED, JUST_VERIFIED_ENABLED, + EFP_DISABLED, EFP_ENABLED, + POAP_DISABLED, POAP_ENABLED, + TALENT_PROTOCOL_DISABLED, + TALENT_PROTOCOL_ENABLED, + XMTP_DISABLED, + XMTP_ENABLED, ...JUST_VERIFIED_EVENTS, } as const; export interface PluginsEventPayload extends JustVerifiedEventsPayload { + [JUST_VERIFIED_DISABLED]: JustVerifiedDisabledPayload; [JUST_VERIFIED_ENABLED]: JustVerifiedEnabledPayload; + [EFP_DISABLED]: EfpDisabledPayload; [EFP_ENABLED]: EfpEnabledPayload; + [POAP_DISABLED]: PoapDisabledPayload; [POAP_ENABLED]: PoapEnabledPayload; + [TALENT_PROTOCOL_DISABLED]: TalentProtocolDisabledPayload; + [TALENT_PROTOCOL_ENABLED]: TalentProtocolEnabledPayload; + [XMTP_DISABLED]: XmtpDisabledPayload; + [XMTP_ENABLED]: XmtpEnabledPayload; } diff --git a/apps/console/src/analytics/events/plugins/just-verified-disabled.ts b/apps/console/src/analytics/events/plugins/just-verified-disabled.ts new file mode 100644 index 00000000..04e21599 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/just-verified-disabled.ts @@ -0,0 +1,3 @@ +export const JUST_VERIFIED_DISABLED = 'JUST_VERIFIED_DISABLED'; + +export interface JustVerifiedDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/justVerified/discord-disabled.ts b/apps/console/src/analytics/events/plugins/justVerified/discord-disabled.ts new file mode 100644 index 00000000..daaac7d4 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/justVerified/discord-disabled.ts @@ -0,0 +1,3 @@ +export const DISCORD_DISABLED = 'DISCORD_DISABLED'; + +export interface DiscordDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/justVerified/email-disabled.ts b/apps/console/src/analytics/events/plugins/justVerified/email-disabled.ts new file mode 100644 index 00000000..bce005b9 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/justVerified/email-disabled.ts @@ -0,0 +1,3 @@ +export const EMAIL_DISABLED = 'EMAIL_DISABLED'; + +export interface EmailDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/justVerified/github-disabled.ts b/apps/console/src/analytics/events/plugins/justVerified/github-disabled.ts new file mode 100644 index 00000000..279b1c9c --- /dev/null +++ b/apps/console/src/analytics/events/plugins/justVerified/github-disabled.ts @@ -0,0 +1,3 @@ +export const GITHUB_DISABLED = 'GITHUB_DISABLED'; + +export interface GithubDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/justVerified/index.ts b/apps/console/src/analytics/events/plugins/justVerified/index.ts index 39456c63..9b9aea16 100644 --- a/apps/console/src/analytics/events/plugins/justVerified/index.ts +++ b/apps/console/src/analytics/events/plugins/justVerified/index.ts @@ -1,21 +1,39 @@ +import { DISCORD_DISABLED, DiscordDisabledPayload } from './discord-disabled'; import { DISCORD_ENABLED, DiscordEnabledPayload } from './discord-enabled'; +import { EMAIL_DISABLED, EmailDisabledPayload } from './email-disabled'; import { EMAIL_ENABLED, EmailEnabledPayload } from './email-enabled'; +import { GITHUB_DISABLED, GithubDisabledPayload } from './github-disabled'; import { GITHUB_ENABLED, GithubEnabledPayload } from './github-enabled'; +import { + TELEGRAM_DISABLED, + TelegramDisabledPayload, +} from './telegram-disabled'; import { TELEGRAM_ENABLED, TelegramEnabledPayload } from './telegram-enabled'; +import { TWITTER_DISABLED, TwitterDisabledPayload } from './twitter-disabled'; import { TWITTER_ENABLED, TwitterEnabledPayload } from './twitter-enabled'; export const JUST_VERIFIED_EVENTS = { + DISCORD_DISABLED, DISCORD_ENABLED, + EMAIL_DISABLED, EMAIL_ENABLED, + GITHUB_DISABLED, GITHUB_ENABLED, + TELEGRAM_DISABLED, TELEGRAM_ENABLED, + TWITTER_DISABLED, TWITTER_ENABLED, } as const; export interface JustVerifiedEventsPayload { + [DISCORD_DISABLED]: DiscordDisabledPayload; [DISCORD_ENABLED]: DiscordEnabledPayload; + [EMAIL_DISABLED]: EmailDisabledPayload; [EMAIL_ENABLED]: EmailEnabledPayload; + [GITHUB_DISABLED]: GithubDisabledPayload; [GITHUB_ENABLED]: GithubEnabledPayload; + [TELEGRAM_DISABLED]: TelegramDisabledPayload; [TELEGRAM_ENABLED]: TelegramEnabledPayload; + [TWITTER_DISABLED]: TwitterDisabledPayload; [TWITTER_ENABLED]: TwitterEnabledPayload; } diff --git a/apps/console/src/analytics/events/plugins/justVerified/telegram-disabled.ts b/apps/console/src/analytics/events/plugins/justVerified/telegram-disabled.ts new file mode 100644 index 00000000..43030e15 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/justVerified/telegram-disabled.ts @@ -0,0 +1,3 @@ +export const TELEGRAM_DISABLED = 'TELEGRAM_DISABLED'; + +export interface TelegramDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/justVerified/twitter-disabled.ts b/apps/console/src/analytics/events/plugins/justVerified/twitter-disabled.ts new file mode 100644 index 00000000..340e4970 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/justVerified/twitter-disabled.ts @@ -0,0 +1,3 @@ +export const TWITTER_DISABLED = 'TWITTER_DISABLED'; + +export interface TwitterDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/poap-disabled.ts b/apps/console/src/analytics/events/plugins/poap-disabled.ts new file mode 100644 index 00000000..aeec0b0f --- /dev/null +++ b/apps/console/src/analytics/events/plugins/poap-disabled.ts @@ -0,0 +1,3 @@ +export const POAP_DISABLED = 'POAP_DISABLED'; + +export interface PoapDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/talent-protocol-disabled.ts b/apps/console/src/analytics/events/plugins/talent-protocol-disabled.ts new file mode 100644 index 00000000..0d0b4cd3 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/talent-protocol-disabled.ts @@ -0,0 +1,3 @@ +export const TALENT_PROTOCOL_DISABLED = 'TALENT_PROTOCOL_DISABLED'; + +export interface TalentProtocolDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/talent-protocol-enabled.ts b/apps/console/src/analytics/events/plugins/talent-protocol-enabled.ts new file mode 100644 index 00000000..53a563b1 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/talent-protocol-enabled.ts @@ -0,0 +1,3 @@ +export const TALENT_PROTOCOL_ENABLED = 'TALENT_PROTOCOL_ENABLED'; + +export interface TalentProtocolEnabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/xmtp-disabled.ts b/apps/console/src/analytics/events/plugins/xmtp-disabled.ts new file mode 100644 index 00000000..c806cf9e --- /dev/null +++ b/apps/console/src/analytics/events/plugins/xmtp-disabled.ts @@ -0,0 +1,3 @@ +export const XMTP_DISABLED = 'XMTP_DISABLED'; + +export interface XmtpDisabledPayload {} diff --git a/apps/console/src/analytics/events/plugins/xmtp-enabled.ts b/apps/console/src/analytics/events/plugins/xmtp-enabled.ts new file mode 100644 index 00000000..a6070183 --- /dev/null +++ b/apps/console/src/analytics/events/plugins/xmtp-enabled.ts @@ -0,0 +1,3 @@ +export const XMTP_ENABLED = 'XMTP_ENABLED'; + +export interface XmtpEnabledPayload {} diff --git a/apps/console/src/analytics/events/signSection/any-ens-selected.ts b/apps/console/src/analytics/events/signSection/any-ens-selected.ts new file mode 100644 index 00000000..b0b49643 --- /dev/null +++ b/apps/console/src/analytics/events/signSection/any-ens-selected.ts @@ -0,0 +1,3 @@ +export const ANY_ENS_SELECTED = 'ANY_ENS_SELECTED'; + +export interface AnyEnsSelectedPayload {} diff --git a/apps/console/src/analytics/events/signSection/claimable-ens-selected.ts b/apps/console/src/analytics/events/signSection/claimable-ens-selected.ts new file mode 100644 index 00000000..ed6b503a --- /dev/null +++ b/apps/console/src/analytics/events/signSection/claimable-ens-selected.ts @@ -0,0 +1,3 @@ +export const CLAIMABLE_ENS_SELECTED = 'CLAIMABLE_ENS_SELECTED'; + +export interface ClaimableEnsSelectedPayload {} diff --git a/apps/console/src/analytics/events/signSection/index.ts b/apps/console/src/analytics/events/signSection/index.ts new file mode 100644 index 00000000..9af93a0d --- /dev/null +++ b/apps/console/src/analytics/events/signSection/index.ts @@ -0,0 +1,21 @@ +import { ANY_ENS_SELECTED, AnyEnsSelectedPayload } from './any-ens-selected'; +import { + CLAIMABLE_ENS_SELECTED, + ClaimableEnsSelectedPayload, +} from './claimable-ens-selected'; +import { + SPECIFIC_ENS_SELECTED, + SpecificEnsSelectedPayload, +} from './specific-ens-selected'; + +export const SIGN_SECTION_EVENTS = { + ANY_ENS_SELECTED, + SPECIFIC_ENS_SELECTED, + CLAIMABLE_ENS_SELECTED, +} as const; + +export interface SignSectionEventPayload { + [ANY_ENS_SELECTED]: AnyEnsSelectedPayload; + [SPECIFIC_ENS_SELECTED]: SpecificEnsSelectedPayload; + [CLAIMABLE_ENS_SELECTED]: ClaimableEnsSelectedPayload; +} diff --git a/apps/console/src/analytics/events/signSection/specific-ens-selected.ts b/apps/console/src/analytics/events/signSection/specific-ens-selected.ts new file mode 100644 index 00000000..21fcacda --- /dev/null +++ b/apps/console/src/analytics/events/signSection/specific-ens-selected.ts @@ -0,0 +1,5 @@ +export const SPECIFIC_ENS_SELECTED = 'SPECIFIC_ENS_SELECTED'; + +export interface SpecificEnsSelectedPayload { + ens: string; +} diff --git a/apps/console/src/app/page.tsx b/apps/console/src/app/page.tsx index d2f314b9..03cc5c44 100644 --- a/apps/console/src/app/page.tsx +++ b/apps/console/src/app/page.tsx @@ -80,7 +80,7 @@ export default function Page() { -

Profile Examples:

+

Profile Examples:

handleEnsClick('justhadi.eth')}> diff --git a/apps/console/src/components/sections/customizer/ClaimSection/index.tsx b/apps/console/src/components/sections/customizer/ClaimSection/index.tsx index 8a331966..57c47e29 100644 --- a/apps/console/src/components/sections/customizer/ClaimSection/index.tsx +++ b/apps/console/src/components/sections/customizer/ClaimSection/index.tsx @@ -5,6 +5,7 @@ import { JustWeb3Context, useDebounce, useJustWeb3 } from '@justweb3/widget'; import { Input } from '../../../ui/input'; import axios from 'axios'; import { ChainId } from '@justaname.id/sdk'; +import { getAnalyticsClient } from '../../../../analytics'; export const ClaimSection = () => { const { config, handleJustWeb3Config } = useContext(JustWeb3Context); @@ -52,12 +53,12 @@ export const ClaimSection = () => { ...(ens === 'jaw.eth' || ens === 'justan.eth' ? [] : [ - { - ensDomain: ens, - apiKey: apiKey, - chainId: 11155111 as ChainId, - }, - ]), + { + ensDomain: ens, + apiKey: apiKey, + chainId: 11155111 as ChainId, + }, + ]), ], }); } @@ -80,8 +81,7 @@ export const ClaimSection = () => { }; statusCode: number; }>( - `https://${ - dev ? 'api-staging' : 'api' + `https://${dev ? 'api-staging' : 'api' }.justaname.id/ens/v1/ens/api-key`, { headers: { @@ -90,6 +90,7 @@ export const ClaimSection = () => { } ) .then((res) => { + getAnalyticsClient().track('ENS_BY_API_KEY_CALLED', {}); setEnsByApiKey(res.data.result.data.domains); }) .catch((err) => { @@ -174,6 +175,9 @@ export const ClaimSection = () => { href={'https://dashboard.justaname.id'} target={'_blank'} className={'text-primary'} + onClick={() => { + getAnalyticsClient().track('DASHBOARD_LINK_CLICKED', {}); + }} > Dashboard {' '} @@ -186,9 +190,9 @@ export const ClaimSection = () => { {index === ensByApiKey.filter((ens) => ens.chainId === chainId) .length - - 1 && ( -
- )} + 1 && ( +
+ )} ))} diff --git a/apps/console/src/components/sections/customizer/Customizer/index.tsx b/apps/console/src/components/sections/customizer/Customizer/index.tsx index dc3a4288..70031b41 100644 --- a/apps/console/src/components/sections/customizer/Customizer/index.tsx +++ b/apps/console/src/components/sections/customizer/Customizer/index.tsx @@ -9,6 +9,7 @@ import { Switch } from '../../../ui/switch'; import { useSwitchChain } from 'wagmi'; import { useMountedAccount } from '@justaname.id/react'; import { PluginsSection } from '../PluginsSection'; +import { getAnalyticsClient } from '../../../../analytics'; interface CustomizerProps { mobile?: boolean; @@ -30,9 +31,8 @@ export const Customizer = ({ mobile }: CustomizerProps) => { return (
@@ -46,6 +46,9 @@ export const Customizer = ({ mobile }: CustomizerProps) => { { + getAnalyticsClient().track('NETWORK_CHANGED', { + chainId: chainId === 1 ? 11155111 : 1, + }); switchChainAsync({ chainId: chainId === 1 ? 11155111 : 1, }); diff --git a/apps/console/src/components/sections/customizer/PluginsSection/EFP/index.tsx b/apps/console/src/components/sections/customizer/PluginsSection/EFP/index.tsx index 60c9a681..7f608bb9 100644 --- a/apps/console/src/components/sections/customizer/PluginsSection/EFP/index.tsx +++ b/apps/console/src/components/sections/customizer/PluginsSection/EFP/index.tsx @@ -27,6 +27,7 @@ export const EFP = () => { (plugin) => plugin.name !== EFPPlugin.name ), }); + getAnalyticsClient().track('EFP_DISABLED', {}); } }; diff --git a/apps/console/src/components/sections/customizer/PluginsSection/JustVerified/index.tsx b/apps/console/src/components/sections/customizer/PluginsSection/JustVerified/index.tsx index 6eb23725..0b65893e 100644 --- a/apps/console/src/components/sections/customizer/PluginsSection/JustVerified/index.tsx +++ b/apps/console/src/components/sections/customizer/PluginsSection/JustVerified/index.tsx @@ -74,26 +74,27 @@ export const JustVerified = () => { (plugin) => plugin.name !== 'JustVerifiedPlugin' ), }); + getAnalyticsClient().track('JUST_VERIFIED_DISABLED', {}); } }; - const handleSocialEnabledAnalytics = (credential: Credentials) => { + const handleSocialEnabledAnalytics = (credential: Credentials, unCheck: boolean) => { switch (credential) { case 'twitter': - getAnalyticsClient().track('TWITTER_ENABLED', {}); + getAnalyticsClient().track(unCheck ? 'TWITTER_DISABLED' : 'TWITTER_ENABLED', {}); break; case 'telegram': - getAnalyticsClient().track('TELEGRAM_ENABLED', {}); + getAnalyticsClient().track(unCheck ? 'TELEGRAM_DISABLED' : 'TELEGRAM_ENABLED', {}); break; case 'github': - getAnalyticsClient().track('GITHUB_ENABLED', {}); + getAnalyticsClient().track(unCheck ? 'GITHUB_DISABLED' : 'GITHUB_ENABLED', {}); break; case 'discord': - getAnalyticsClient().track('DISCORD_ENABLED', {}); + getAnalyticsClient().track(unCheck ? 'DISCORD_DISABLED' : 'DISCORD_ENABLED', {}); break; case 'email': - getAnalyticsClient().track('EMAIL_ENABLED', {}); + getAnalyticsClient().track(unCheck ? 'EMAIL_DISABLED' : 'EMAIL_ENABLED', {}); break; default: break; @@ -156,7 +157,7 @@ export const JustVerified = () => { onCheck={(platform) => { if (justVerified) { setJustVerified([...justVerified, platform as Credentials]); - handleSocialEnabledAnalytics(platform as Credentials); + handleSocialEnabledAnalytics(platform as Credentials, false); } }} onUncheck={(platform) => { @@ -164,6 +165,7 @@ export const JustVerified = () => { setJustVerified( justVerified.filter((verified) => verified !== platform) ); + handleSocialEnabledAnalytics(platform as Credentials, true); } }} /> diff --git a/apps/console/src/components/sections/customizer/PluginsSection/POAP/index.tsx b/apps/console/src/components/sections/customizer/PluginsSection/POAP/index.tsx index aded14fe..e3c92f19 100644 --- a/apps/console/src/components/sections/customizer/PluginsSection/POAP/index.tsx +++ b/apps/console/src/components/sections/customizer/PluginsSection/POAP/index.tsx @@ -27,6 +27,7 @@ export const POAP = () => { (plugin) => plugin.name !== POAPPluginInstance.name ), }); + getAnalyticsClient().track('POAP_DISABLED', {}); } }; diff --git a/apps/console/src/components/sections/customizer/PluginsSection/TalentProtocol/index.tsx b/apps/console/src/components/sections/customizer/PluginsSection/TalentProtocol/index.tsx index 503dd8b2..b524d652 100644 --- a/apps/console/src/components/sections/customizer/PluginsSection/TalentProtocol/index.tsx +++ b/apps/console/src/components/sections/customizer/PluginsSection/TalentProtocol/index.tsx @@ -2,6 +2,7 @@ import { Switch } from '../../../../ui/switch'; import { useContext } from 'react'; import { JustWeb3Context } from '@justweb3/widget'; import { TalentProtocolPlugin } from '@justweb3/talent-protocol-plugin'; +import { getAnalyticsClient } from '../../../../../analytics'; export const TalentProtocol = () => { const { handleJustWeb3Config, config } = useContext(JustWeb3Context); @@ -18,6 +19,7 @@ export const TalentProtocol = () => { TalentProtocolPluginInstance, ], }); + getAnalyticsClient().track('TALENT_PROTOCOL_ENABLED', {}); } else { handleJustWeb3Config({ ...config, @@ -25,6 +27,7 @@ export const TalentProtocol = () => { (plugin) => plugin.name !== TalentProtocolPluginInstance.name ), }); + getAnalyticsClient().track('TALENT_PROTOCOL_DISABLED', {}); } }; diff --git a/apps/console/src/components/sections/customizer/PluginsSection/XMTP/index.tsx b/apps/console/src/components/sections/customizer/PluginsSection/XMTP/index.tsx index a5dfc358..15f801c9 100644 --- a/apps/console/src/components/sections/customizer/PluginsSection/XMTP/index.tsx +++ b/apps/console/src/components/sections/customizer/PluginsSection/XMTP/index.tsx @@ -2,6 +2,7 @@ import { Switch } from '../../../../ui/switch'; import { useContext } from 'react'; import { JustWeb3Context } from '@justweb3/widget'; import { XMTPPlugin } from '@justweb3/xmtp-plugin'; +import { getAnalyticsClient } from '../../../../../analytics'; export const XMTP = () => { const { handleJustWeb3Config, config } = useContext(JustWeb3Context); @@ -17,6 +18,7 @@ export const XMTP = () => { XMTPPlugin('production'), ], }); + getAnalyticsClient().track('XMTP_ENABLED', {}); } else { handleJustWeb3Config({ ...config, @@ -24,8 +26,9 @@ export const XMTP = () => { (plugin) => plugin.name !== 'XMTPPlugin' ), }); - } - }; + getAnalyticsClient().track('XMTP_DISABLED', {}); + }; + } return (
diff --git a/apps/console/src/components/sections/customizer/SignSection/index.tsx b/apps/console/src/components/sections/customizer/SignSection/index.tsx index 0d09eb40..be0231be 100644 --- a/apps/console/src/components/sections/customizer/SignSection/index.tsx +++ b/apps/console/src/components/sections/customizer/SignSection/index.tsx @@ -4,6 +4,7 @@ import { useContext, useEffect, useState } from 'react'; import { JustWeb3Context, JustWeb3ProviderConfig } from '@justweb3/widget'; import { Input } from '../../../ui/input'; import Image from 'next/image'; +import { getAnalyticsClient } from '../../../../analytics'; export const SignSection = () => { const { handleJustWeb3Config, config } = useContext(JustWeb3Context); @@ -27,6 +28,14 @@ export const SignSection = () => { defaultValue="all" onValueChange={(e) => { const action = e as JustWeb3ProviderConfig['allowedEns']; + switch (action) { + case 'all': + getAnalyticsClient().track('ANY_ENS_SELECTED', {}); + break; + case 'claimable': + getAnalyticsClient().track('CLAIMABLE_ENS_SELECTED', {}); + break; + } handleJustWeb3Config({ ...config, allowedEns: @@ -50,6 +59,9 @@ export const SignSection = () => { placeholder="Add ENS" onKeyUp={(e) => { if (e.key === 'Enter') { + getAnalyticsClient().track('SPECIFIC_ENS_SELECTED', { + ens: ensInput, + }); setEnsList([...ensList, ensInput]); setEnsInput(''); }