Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 1e771af

Browse files
author
Andrew Schneider
authored
Merge pull request #1839 from blockchain/feat/wallet-tour-analytics
Added analytics to wallet tour
2 parents e191c6f + d9469ef commit 1e771af

4 files changed

Lines changed: 79 additions & 17 deletions

File tree

packages/blockchain-wallet-v4-frontend/src/data/analytics/model.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,28 @@ export const AB_TESTS = {
154154
}
155155

156156
export const GENERAL_EVENTS = {
157-
SKIP_WALLET_TOUR: ['general', 'skip_wallet_tour'],
158-
TAKE_WALLET_TOUR: ['general', 'take_wallet_tour'],
159157
VIEW_WHATS_NEW: ['general', 'view_whats_new'],
160-
VIEW_FAQ: ['general', 'view_faq']
158+
VIEW_FAQ: ['general', 'view_faq'],
159+
WALLET_INTRO_DISMISSED: ['general', 'wallet_intro_tour', 'dismissed'],
160+
WALLET_INTRO_OFFERED: ['general', 'wallet_intro_tour', 'offered'],
161+
WALLET_INTRO_STARTED: ['general', 'wallet_intro_tour', 'started'],
162+
WALLET_INTRO_PORTFOLIO_VIEWED: [
163+
'general',
164+
'wallet_intro_tour',
165+
'step_view_portfolio'
166+
],
167+
WALLET_INTRO_REQUEST_VIEWED: [
168+
'general',
169+
'wallet_intro_tour',
170+
'step_view_request'
171+
],
172+
WALLET_INTRO_SEND_VIEWED: ['general', 'wallet_intro_tour', 'step_view_send'],
173+
WALLET_INTRO_SWAP_VIEWED: ['general', 'wallet_intro_tour', 'step_view_swap'],
174+
WALLET_INTRO_BUYSELL_VIEWED: [
175+
'general',
176+
'wallet_intro_tour',
177+
'step_view_buysell'
178+
]
161179
}
162180

163181
export const ADS_EVENTS = {

packages/blockchain-wallet-v4-frontend/src/data/components/onboarding/sagas.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export default () => {
7474
})
7575
)
7676
yield put(actions.core.kvStore.whatsNew.setHasSkippedWalletTour(true))
77-
yield put(actions.analytics.logEvent(GENERAL_EVENTS.SKIP_WALLET_TOUR))
77+
yield put(
78+
actions.analytics.logEvent(GENERAL_EVENTS.WALLET_INTRO_DISMISSED)
79+
)
7880
yield put(actions.modals.closeModal())
7981
} catch (e) {
8082
yield put(
@@ -88,7 +90,7 @@ export default () => {
8890
yield put(actions.modals.closeModal())
8991
yield put(actions.components.onboarding.setWalletTourVisibility(true))
9092
yield put(actions.core.kvStore.whatsNew.setHasSkippedWalletTour(false))
91-
yield put(actions.analytics.logEvent(GENERAL_EVENTS.TAKE_WALLET_TOUR))
93+
yield put(actions.analytics.logEvent(GENERAL_EVENTS.WALLET_INTRO_STARTED))
9294
} catch (e) {
9395
yield put(
9496
actions.logs.logErrorMessage(logLocation, 'takeWalletTourClicked', e)

packages/blockchain-wallet-v4-frontend/src/data/goals/sagas.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { getBtcBalance, getAllBalances } from 'data/balance/sagas'
3030
import { parsePaymentRequest } from 'data/bitpay/sagas'
3131
import profileSagas from 'data/modules/profile/sagas'
3232

33-
const { DEEPLINK_EVENTS, TRANSACTION_EVENTS } = model.analytics
33+
const { DEEPLINK_EVENTS, GENERAL_EVENTS, TRANSACTION_EVENTS } = model.analytics
3434

3535
export default ({ api }) => {
3636
const { TIERS, KYC_STATES, DOC_RESUBMISSION_REASONS } = model.profile
@@ -519,8 +519,9 @@ export default ({ api }) => {
519519
return yield put(actions.modals.showModal(airdropClaim.name))
520520
}
521521
if (walletTour) {
522+
yield put(actions.modals.showModal(walletTour.name, walletTour.data))
522523
return yield put(
523-
actions.modals.showModal(walletTour.name, walletTour.data)
524+
actions.analytics.logEvent(GENERAL_EVENTS.WALLET_INTRO_OFFERED)
524525
)
525526
}
526527
}

packages/blockchain-wallet-v4-frontend/src/scenes/Home/model.js

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import React from 'react'
1+
import { bindActionCreators } from 'redux'
2+
import { connect } from 'react-redux'
3+
import React, { useEffect } from 'react'
24
import { FormattedMessage } from 'react-intl'
35
import styled, { keyframes } from 'styled-components'
46

57
import { Button, Icon, Image, Text } from 'blockchain-info-components'
8+
import { actions, model } from 'data'
9+
10+
const { GENERAL_EVENTS } = model.analytics
611

712
const Scale = () => {
813
return keyframes`
@@ -77,28 +82,55 @@ const CloseTourIcon = styled(Icon)`
7782
}
7883
`
7984

80-
export const TourTooltip = props => {
85+
const TourTooltipComponent = ({
86+
analyticsActions,
87+
index,
88+
isLastStep,
89+
primaryProps,
90+
skipProps,
91+
step,
92+
tooltipProps,
93+
...rest
94+
}) => {
95+
useEffect(() => {
96+
switch (index) {
97+
case 0:
98+
analyticsActions.logEvent(GENERAL_EVENTS.WALLET_INTRO_PORTFOLIO_VIEWED)
99+
break
100+
case 1:
101+
analyticsActions.logEvent(GENERAL_EVENTS.WALLET_INTRO_REQUEST_VIEWED)
102+
break
103+
case 2:
104+
analyticsActions.logEvent(GENERAL_EVENTS.WALLET_INTRO_SEND_VIEWED)
105+
break
106+
case 3:
107+
analyticsActions.logEvent(GENERAL_EVENTS.WALLET_INTRO_SWAP_VIEWED)
108+
break
109+
case 4:
110+
analyticsActions.logEvent(GENERAL_EVENTS.WALLET_INTRO_BUYSELL_VIEWED)
111+
break
112+
}
113+
}, [index])
114+
81115
return (
82-
<TooltipBody {...props.tooltipProps}>
116+
<TooltipBody {...tooltipProps}>
83117
<CloseTourIcon
84118
color='grey400'
85119
name='close'
86120
size='16px'
87121
weight={600}
88-
{...props.skipProps}
122+
{...skipProps}
89123
/>
90-
{props.step.content && (
91-
<TooltipContent>{props.step.content}</TooltipContent>
92-
)}
93-
<TooltipFooter isLastStep={props.isLastStep}>
124+
{step.content && <TooltipContent>{step.content}</TooltipContent>}
125+
<TooltipFooter isLastStep={isLastStep}>
94126
<Button
95127
width='110px'
96128
height='48px'
97129
nature='primary'
98130
fullwidth
99-
{...props.primaryProps}
131+
{...primaryProps}
100132
>
101-
{props.isLastStep ? (
133+
{isLastStep ? (
102134
<FormattedMessage id='wallet.tour.finish' defaultMessage='Close' />
103135
) : (
104136
<FormattedMessage id='wallet.tour.next' defaultMessage='Next' />
@@ -221,3 +253,12 @@ export const TOUR_STEPS = [
221253
disableBeacon: true
222254
}
223255
]
256+
257+
const mapDispatchToProps = dispatch => ({
258+
analyticsActions: bindActionCreators(actions.analytics, dispatch)
259+
})
260+
261+
export const TourTooltip = connect(
262+
null,
263+
mapDispatchToProps
264+
)(TourTooltipComponent)

0 commit comments

Comments
 (0)