-
Notifications
You must be signed in to change notification settings - Fork 12
feat(analytics): add tools event tracking and shared event constants #664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6579ea8
118e943
3dd8b6a
95649ef
f5b43de
613f985
5b8bc1c
51274ac
db4fd66
100df55
28ae2bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import { | |
| } from '@/components' | ||
| import { TOOL_BANNER, TOOL_OFFERWALL, TOOL_WIDGET } from '@shared/types' | ||
| import { useDialog } from '~/hooks/useDialog' | ||
| import { useTrackEvent } from '~/lib/analytics' | ||
| import { ApiError } from '~/lib/helpers' | ||
| import { actions as bannerActions } from '~/stores/banner-store' | ||
| import { actions as offerwallActions } from '~/stores/offerwall-store' | ||
|
|
@@ -28,6 +29,7 @@ function getToolActions() { | |
|
|
||
| export const useSaveProfile = (wallet: WalletStore) => { | ||
| const [openDialog, closeDialog] = useDialog() | ||
| const trackEvent = useTrackEvent() | ||
|
|
||
| const save = useCallback( | ||
| async (action: 'save-success' | 'script'): Promise<void> => { | ||
|
|
@@ -48,10 +50,18 @@ export const useSaveProfile = (wallet: WalletStore) => { | |
|
|
||
| if (result.success) { | ||
| actions.commitProfile() | ||
|
|
||
| trackEvent('settings_changed', { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove this event for now - this one here is fired even if settings aren't changed. |
||
| tool: toolState.currentToolType, | ||
| }) | ||
| if (action === 'script') { | ||
| trackEvent('script_generated', { | ||
| tool: toolState.currentToolType, | ||
| }) | ||
| openDialog(<ScriptDialog wallet={wallet} />) | ||
| } else { | ||
| trackEvent('profile_saved', { | ||
|
Comment on lines
+57
to
+62
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need two separate events for this? What if we pass an |
||
| tool: toolState.currentToolType, | ||
| }) | ||
| openDialog(<StatusDialog onDone={closeDialog} />) | ||
| } | ||
| } | ||
|
|
@@ -69,7 +79,7 @@ export const useSaveProfile = (wallet: WalletStore) => { | |
| ) | ||
| } | ||
| }, | ||
| [openDialog, closeDialog], | ||
| [openDialog, closeDialog, trackEvent], | ||
| ) | ||
|
|
||
| const saveLastAction = useCallback(async (): Promise<void> => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import type { Tool } from '@shared/types' | ||
|
|
||
| export type ToolsEventMap = { | ||
|
kjmitchelljr marked this conversation as resolved.
|
||
| click_card_tool: { link: string } | ||
| wallet_connected: { wallet_provider: string } | ||
| wallet_disconnected: undefined | ||
| profile_saved: { tool: Tool } | ||
| script_generated: { tool: Tool } | ||
| settings_changed: { tool: Tool } | ||
| generated_tag: { tag_type: 'link_tag' | 'revshare' } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the same save /submit event here from other tools and pass
tool: "link_tag"with it?