Skip to content

Commit

Permalink
feat: browser wallet and show more/less wallets metric events
Browse files Browse the repository at this point in the history
  • Loading branch information
manneredboor committed Jul 31, 2024
1 parent 80dd8c3 commit 956f6c6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 10 deletions.
12 changes: 12 additions & 0 deletions consts/matomo-click-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { MatomoEventType } from '@lidofinance/analytics-matomo';
export const enum MATOMO_CLICK_EVENTS_TYPES {
// Global
connectWallet = 'connectWallet',
clickShowMoreWallets = 'clickShowMoreWallets',
clickShowLessWallets = 'clickShowLessWallets',
clickCurvePool = 'clickCurvePool',
clickBalancerPool = 'clickBalancerPool',
clickExploreDeFi = 'clickExploreDeFi',
Expand Down Expand Up @@ -79,6 +81,16 @@ export const MATOMO_CLICK_EVENTS: Record<
'Push "Connect wallet" button',
'eth_widget_connect_wallet',
],
[MATOMO_CLICK_EVENTS_TYPES.clickShowMoreWallets]: [
'Ethereum_Staking_Widget',
'Push "More wallets" on wallet modal',
'eth_widget_more_wallets',
],
[MATOMO_CLICK_EVENTS_TYPES.clickShowLessWallets]: [
'Ethereum_Staking_Widget',
'Push "Less wallets" on wallet modal',
'eth_widget_less_wallets',
],
[MATOMO_CLICK_EVENTS_TYPES.clickCurvePool]: [
'Ethereum_Staking_Widget',
'Push «Explore» in Curve section on Transaction success banner',
Expand Down
18 changes: 18 additions & 0 deletions consts/matomo-wallets-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const enum MATOMO_WALLETS_EVENTS_TYPES {
onConnectOkx = 'onConnectOkx',
onClickBitget = 'onClickBitget',
onConnectBitget = 'onConnectBitget',
onClickBrowser = 'onClickBrowser',
onConnectBrowser = 'onConnectBrowser',
}

export const MATOMO_WALLETS_EVENTS: Record<
Expand Down Expand Up @@ -165,6 +167,16 @@ export const MATOMO_WALLETS_EVENTS: Record<
'Connect BitGet wallet',
'eth_widget_connect_bitget',
],
[MATOMO_WALLETS_EVENTS_TYPES.onClickBrowser]: [
'Ethereum_Staking_Widget',
'Click Browser wallet',
'eth_widget_click_browser',
],
[MATOMO_WALLETS_EVENTS_TYPES.onConnectBrowser]: [
'Ethereum_Staking_Widget',
'Connect Browser wallet',
'eth_widget_connect_browser',
],
};

const getMetricHandler = (event: Parameters<typeof trackEvent>) => () =>
Expand All @@ -187,6 +199,9 @@ export const walletsMetrics: Metrics<WalletIdsEthereum> = {
xdefi: getMetricHandler(MATOMO_WALLETS_EVENTS.onClickXdefi),
okx: getMetricHandler(MATOMO_WALLETS_EVENTS.onClickOkx),
bitget: getMetricHandler(MATOMO_WALLETS_EVENTS.onClickBitget),
browserExtension: getMetricHandler(
MATOMO_WALLETS_EVENTS.onClickBrowser,
),
},
},
connect: {
Expand All @@ -204,6 +219,9 @@ export const walletsMetrics: Metrics<WalletIdsEthereum> = {
xdefi: getMetricHandler(MATOMO_WALLETS_EVENTS.onConnectXdefi),
okx: getMetricHandler(MATOMO_WALLETS_EVENTS.onConnectOkx),
bitget: getMetricHandler(MATOMO_WALLETS_EVENTS.onConnectBitget),
browserExtension: getMetricHandler(
MATOMO_WALLETS_EVENTS.onConnectBrowser,
),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"react-hook-form": "^7.45.2",
"react-is": "^18.2.0",
"react-transition-group": "^4.4.2",
"reef-knot": "5.2.1",
"reef-knot": "5.2.3",
"remark": "^13.0.0",
"remark-external-links": "^8.0.0",
"remark-html": "^13.0.1",
Expand Down
8 changes: 8 additions & 0 deletions shared/wallet/connect-wallet-modal/connect-wallet-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { WalletIdsEthereum } from 'reef-knot/wallets';

import { config } from 'config';
import { walletsMetrics } from 'consts/matomo-wallets-events';
import { trackEvent } from '@lidofinance/analytics-matomo';
import { MATOMO_CLICK_EVENTS } from 'consts/matomo-click-events';

const WALLETS_PINNED: WalletIdsEthereum[] = ['okx', 'browserExtension'];

Expand All @@ -17,6 +19,12 @@ export const ConnectWalletModal = () => {
walletsPinned={WALLETS_PINNED}
termsLink={`${config.rootOrigin}/terms-of-use`}
privacyNoticeLink={`${config.rootOrigin}/privacy-notice`}
onClickWalletsMore={() =>
trackEvent(...MATOMO_CLICK_EVENTS.clickShowMoreWallets)
}
onClickWalletsLess={() =>
trackEvent(...MATOMO_CLICK_EVENTS.clickShowLessWallets)
}
/>
);
};
50 changes: 41 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2734,10 +2734,10 @@
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.24.tgz#58601079e11784d20f82d0585865bb42305c4df3"
integrity sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==

"@reef-knot/connect-wallet-modal@5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@reef-knot/connect-wallet-modal/-/connect-wallet-modal-5.2.0.tgz#762d3b570b58405a6050b49eb16dbab5af009ab0"
integrity sha512-V75YfqrwHUrKWyo1McyuoMTFbGg/xFcc7pQSiQMxl1eRGBjL8nxtxj0Uj2Zv/3remCBCIq4VTP2J3DiGZQnUiw==
"@reef-knot/connect-wallet-modal@5.2.2":
version "5.2.2"
resolved "https://registry.yarnpkg.com/@reef-knot/connect-wallet-modal/-/connect-wallet-modal-5.2.2.tgz#519377324db27a4570df2801aa0c113dadad3d0a"
integrity sha512-0ZT7bjFnuSa2dfWcV4yLouInMnWV9gy/CVsETKxTdU5u7wjOU1l2KnaGrSZCctTi3OxkJFkDI0uimApPnhF/Uw==
dependencies:
"@ledgerhq/hw-app-eth" "^6.37.1"
"@ledgerhq/hw-transport" "^6.31.0"
Expand Down Expand Up @@ -3833,6 +3833,7 @@
eventemitter3 "5.0.1"
mipd "0.0.5"
zustand "4.4.1"

"@walletconnect/core@2.13.0":
version "2.13.0"
resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.13.0.tgz#6b79b039930643e8ee85a0f512b143a35fdb8b52"
Expand Down Expand Up @@ -4122,6 +4123,11 @@ JSONStream@^1.3.5:
jsonparse "^1.2.0"
through ">=2.2.7 <3"

abitype@0.9.8:
version "0.9.8"
resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.8.tgz#1f120b6b717459deafd213dfbf3a3dd1bf10ae8c"
integrity sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ==

abitype@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.0.tgz#237176dace81d90d018bebf3a45cb42f2a2d9e97"
Expand Down Expand Up @@ -7252,6 +7258,11 @@ isomorphic-unfetch@3.1.0:
node-fetch "^2.6.1"
unfetch "^4.2.0"

isows@1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74"
integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==

isows@1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061"
Expand Down Expand Up @@ -8392,6 +8403,13 @@ minimist@^1.2.0, minimist@^1.2.6:
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==

mipd@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/mipd/-/mipd-0.0.5.tgz#367ee796531c23f0631f129038700b1406663aec"
integrity sha512-gbKA784D2WKb5H/GtqEv+Ofd1S9Zj+Z/PGDIl1u1QAbswkxD28BQ5bSXQxkeBzPBABg1iDSbiwGG1XqlOxRspA==
dependencies:
viem "^1.1.4"

mipd@0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/mipd/-/mipd-0.0.7.tgz#bb5559e21fa18dc3d9fe1c08902ef14b7ce32fd9"
Expand Down Expand Up @@ -9390,12 +9408,12 @@ redis-parser@^3.0.0:
dependencies:
redis-errors "^1.0.0"

reef-knot@5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/reef-knot/-/reef-knot-5.2.1.tgz#18a7aa8817896d951d88d0a8212af91c12d65de4"
integrity sha512-3iZRohLSziJXrSqcA9bfGtrAqy3w+gmFlnrDEX7ryTpje1M7aksNZU/Y91AYxZJB0xv3Lv+5+2A/hhijYffSKA==
reef-knot@5.2.3:
version "5.2.3"
resolved "https://registry.yarnpkg.com/reef-knot/-/reef-knot-5.2.3.tgz#23554c91828454048889d7107aeb859089fb6581"
integrity sha512-L7cWKM+UNZpPGbGzraW6aoZZB3qyqOy7RU4Yic/54hHb63QOhD5f1cNnUi8mVAI2d+s/vrSCLznR1aLuf4RghA==
dependencies:
"@reef-knot/connect-wallet-modal" "5.2.0"
"@reef-knot/connect-wallet-modal" "5.2.2"
"@reef-knot/core-react" "4.1.1"
"@reef-knot/ledger-connector" "4.1.0"
"@reef-knot/types" "2.0.1"
Expand Down Expand Up @@ -10937,6 +10955,20 @@ viem@2.13.3:
isows "1.0.4"
ws "8.13.0"

viem@^1.1.4:
version "1.21.4"
resolved "https://registry.yarnpkg.com/viem/-/viem-1.21.4.tgz#883760e9222540a5a7e0339809202b45fe6a842d"
integrity sha512-BNVYdSaUjeS2zKQgPs+49e5JKocfo60Ib2yiXOWBT6LuVxY1I/6fFX3waEtpXvL1Xn4qu+BVitVtMh9lyThyhQ==
dependencies:
"@adraffy/ens-normalize" "1.10.0"
"@noble/curves" "1.2.0"
"@noble/hashes" "1.3.2"
"@scure/bip32" "1.3.2"
"@scure/bip39" "1.2.1"
abitype "0.9.8"
isows "1.0.3"
ws "8.13.0"

viem@^2.1.1:
version "2.17.9"
resolved "https://registry.yarnpkg.com/viem/-/viem-2.17.9.tgz#40ffd00a31621c8efdc4d49a58d5d30dc2d38d83"
Expand Down

0 comments on commit 956f6c6

Please sign in to comment.