Skip to content

Commit

Permalink
fix: Adjust safe creation event to include safeAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Oct 18, 2023
1 parent 8189cd7 commit bf16b73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { updateAddressBook } from '@/components/new-safe/create/logic/address-bo
import { useAppDispatch } from '@/store'
import useChainId from '@/hooks/useChainId'
import { usePendingSafe } from './usePendingSafe'
import { gtmSetSafeAddress } from '@/services/analytics/gtm'

const useSafeCreationEffects = ({
status,
Expand Down Expand Up @@ -74,6 +75,7 @@ const useSafeCreationEffects = ({
// Tracking
useEffect(() => {
if (status === SafeCreationStatus.SUCCESS) {
pendingSafe?.safeAddress && gtmSetSafeAddress(pendingSafe.safeAddress)
trackEvent(CREATE_SAFE_EVENTS.CREATED_SAFE)
return
}
Expand All @@ -82,7 +84,7 @@ const useSafeCreationEffects = ({
trackEvent(CREATE_SAFE_EVENTS.REJECT_CREATE_SAFE)
return
}
}, [status])
}, [pendingSafe?.safeAddress, status])
}

export default useSafeCreationEffects
2 changes: 2 additions & 0 deletions src/services/analytics/useGtm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const useGtm = () => {

// Set safe address for all GTM events
useEffect(() => {
if (safeAddress === '') return

gtmSetSafeAddress(safeAddress)
}, [safeAddress])

Expand Down

0 comments on commit bf16b73

Please sign in to comment.