Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

fix: Track more safe creation steps #3965

Merged
merged 4 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/routes/CreateSafePage/components/SafeCreationProcess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const createNewSafe = (userAddress: string, onHash: (hash: string) => void): Pro
deploymentTx
.send(sendParams)
.once('transactionHash', (txHash) => {
trackEvent(CREATE_SAFE_EVENTS.SUBMIT_CREATE_SAFE)
onHash(txHash)

saveToStorage(SAFE_PENDING_CREATION_STORAGE_KEY, {
Expand Down Expand Up @@ -255,6 +256,7 @@ function SafeCreationProcess(): ReactElement {
}

const onRetry = (): void => {
trackEvent(CREATE_SAFE_EVENTS.RETRY_CREATE_SAFE)
const safeCreationFormValues = loadSavedDataOrLeave()

if (!safeCreationFormValues) {
Expand All @@ -272,6 +274,7 @@ function SafeCreationProcess(): ReactElement {
}

const onCancel = () => {
trackEvent(CREATE_SAFE_EVENTS.CANCEL_CREATE_SAFE)
removeFromStorage(SAFE_PENDING_CREATION_STORAGE_KEY)
goToWelcomePage()
}
Expand Down
6 changes: 6 additions & 0 deletions src/routes/opening/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import { showNotification } from 'src/logic/notifications/store/notifications'
import { getNewSafeAddressFromLogs } from 'src/routes/opening/utils/getSafeAddressFromLogs'
import { getExplorerInfo } from 'src/config'
import PrefixedEthHashInfo from 'src/components/PrefixedEthHashInfo'
import { trackEvent } from 'src/utils/googleTagManager'
import { CREATE_SAFE_EVENTS } from 'src/utils/events/createLoadSafe'
import { isWalletRejection } from 'src/logic/wallets/errors'

export const SafeDeployment = ({
creationTxHash,
Expand Down Expand Up @@ -119,6 +122,9 @@ export const SafeDeployment = ({
setStepIndex(1)
setIntervalStarted(true)
} catch (err) {
if (isWalletRejection(err)) {
trackEvent(CREATE_SAFE_EVENTS.REJECT_CREATE_SAFE)
}
onError(err)
}
}
Expand Down
16 changes: 16 additions & 0 deletions src/utils/events/createLoadSafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ const CREATE_SAFE = {
event: GTM_EVENT.META,
action: 'Threshold',
},
SUBMIT_CREATE_SAFE: {
event: GTM_EVENT.META,
action: 'Submit Safe creation',
},
REJECT_CREATE_SAFE: {
event: GTM_EVENT.META,
action: 'Reject Safe creation',
},
RETRY_CREATE_SAFE: {
event: GTM_EVENT.META,
action: 'Retry Safe creation',
},
CANCEL_CREATE_SAFE: {
event: GTM_EVENT.META,
action: 'Cancel Safe creation',
},
CREATED_SAFE: {
event: GTM_EVENT.META,
action: 'Created Safe',
Expand Down