Skip to content

Commit

Permalink
Change registration tracking event name to snake case
Browse files Browse the repository at this point in the history
  • Loading branch information
nhohb committed Sep 6, 2024
1 parent 33be2fe commit 5a7ceca
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/components/@molecules/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ const createSearchHandler =
{ lastAccessed: Date.now(), nameType, text, isValid: selectedItem.isValid },
])

trackRegistrationEvent('Search selected', { keyword: text })
trackRegistrationEvent('search_selected', { keyword: text })

const path = getRouteForSearchItem({ address, chainId, queryClient, selectedItem })
setInputVal('')
Expand Down Expand Up @@ -696,7 +696,7 @@ export const SearchInput = ({ size = 'extraLarge' }: { size?: 'medium' | 'extraL
setInputVal(val)
setUsingPlaceholder(true)
debouncer(() => setUsingPlaceholder(false))
debouncer(() => trackRegistrationEvent('Start searching', { keyword: val }))
debouncer(() => trackRegistrationEvent('start_searching', { keyword: val }))
}

const SearchInputElement = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export const TransactionStageModal = ({

if (['commitName', 'registerName'].includes(actionName)) {
trackRegistrationEvent(
actionName === 'commitName' ? 'Commit Wallet Opened' : 'Finish Wallet Opened',
actionName === 'commitName' ? 'commit_wallet_opened' : 'finish_wallet_opened',
)
}
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/dotbox/[name]/DotBoxRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const DotBoxRegistration = () => {
<Button
width="45"
size="small"
onClick={() => trackRegistrationEvent('Registration started')}
onClick={() => trackRegistrationEvent('registration_started')}
>
<OutlinkInner>
Register on my.box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const Registration = ({ nameDetails, isLoading }: Props) => {

const infoCallback = ({ back }: BackObj) => {
genericCallback({ back })
trackRegistrationEvent('Commit started')
trackRegistrationEvent('commit_started')
}

const transactionsCallback = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const Transactions = ({ registrationData, name, callback, onStart }: Props) => {
resumeLink: `/register/${name}`,
})

trackRegistrationEvent('Finish started')
trackRegistrationEvent('finish_started')
}

const showCommitTransaction = () => {
Expand All @@ -153,7 +153,7 @@ const Transactions = ({ registrationData, name, callback, onStart }: Props) => {
const showRegisterTransaction = () => {
resumeTransactionFlow(registerKey)

trackRegistrationEvent('Finish started')
trackRegistrationEvent('finish_started')
}

const resetTransactions = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useRegistrationEventTracker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('useRegistrationEventTracker', () => {
})

it('should call trackEvent with correct arguments when trackRegistrationEvent is called', async () => {
const type: PlausibleType = 'Start searching'
const type: PlausibleType = 'start_searching'
const props: PlausibleProps = { keyword: 'test' }
const { result } = renderHook(() => useRegistrationEventTracker())
result.current.trackRegistrationEvent(type, props)
Expand All @@ -49,7 +49,7 @@ describe('useRegistrationEventTracker', () => {
const ethPrice = 156058000000n
const paymentAmount = formatUnits((estimatedTotal * ethPrice) / BigInt(1e8), 18)

const type: PlausibleType = 'Payment selected'
const type: PlausibleType = 'payment_selected'
const props: PlausibleProps = {
duration,
durationType: 'date',
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useRegistrationEventTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const useRegistrationEventTracker = () => {
currencyUnit: 'usd',
}

trackRegistrationEvent('Payment selected', props)
trackRegistrationEvent('payment_selected', props)
},
[trackRegistrationEvent],
)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default function Page() {
const { trackRegistrationEvent } = useRegistrationEventTracker()

useEffect(() => {
trackRegistrationEvent('Home page')
trackRegistrationEvent('home_page')
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

Expand Down
18 changes: 9 additions & 9 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ export type PlausibleType =
| 'register'
| 'commit'
| 'renew'
| 'Home page'
| 'Start searching'
| 'Search selected'
| 'Payment selected'
| 'Commit started'
| 'Commit Wallet Opened'
| 'Finish started'
| 'Finish Wallet Opened'
| 'Registration started'
| 'home_page'
| 'start_searching'
| 'search_selected'
| 'payment_selected'
| 'commit_started'
| 'commit_wallet_opened'
| 'finish_started'
| 'finish_wallet_opened'
| 'registration_started'

export type PlausibleProps = {
referrer?: string | null
Expand Down

0 comments on commit 5a7ceca

Please sign in to comment.