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

Commit

Permalink
fix: Track more safe creation steps (#3965)
Browse files Browse the repository at this point in the history
* fix: Track more safe creation steps

* Update src/utils/events/createLoadSafe.ts

Co-authored-by: Aaron Cook <[email protected]>

* fix: Check for wallet rejection before tracking

* fix: Remove back button after safe creation submission

Co-authored-by: Aaron Cook <[email protected]>
  • Loading branch information
usame-algan and iamacook authored Jun 15, 2022
1 parent 468e0b0 commit b83b3e4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
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
18 changes: 6 additions & 12 deletions src/routes/opening/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import styled from 'styled-components'
import { ErrorFooter } from 'src/routes/opening/components/Footer'
import { isConfirmationStep, steps } from './steps'

import Button from 'src/components/layout/Button'
import Heading from 'src/components/layout/Heading'
import Img from 'src/components/layout/Img'
import Paragraph from 'src/components/layout/Paragraph'
Expand All @@ -25,6 +24,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 +121,9 @@ export const SafeDeployment = ({
setStepIndex(1)
setIntervalStarted(true)
} catch (err) {
if (isWalletRejection(err)) {
trackEvent(CREATE_SAFE_EVENTS.REJECT_CREATE_SAFE)
}
onError(err)
}
}
Expand Down Expand Up @@ -309,12 +314,6 @@ export const SafeDeployment = ({
) : null}
</BodyFooter>
</Body>

{stepIndex !== 0 && (
<BackButton color="primary" minWidth={140} onClick={onCancel} data-testid="safe-creation-back-btn">
Back
</BackButton>
)}
</Wrapper>
)
}
Expand Down Expand Up @@ -418,8 +417,3 @@ const BodyFooter = styled.div`
justify-content: center;
align-items: flex-end;
`

const BackButton = styled(Button)`
grid-column: 2;
margin: 20px auto 0;
`
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

0 comments on commit b83b3e4

Please sign in to comment.