Skip to content

Commit

Permalink
fix: add collect event (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
qinluhe authored Dec 31, 2024
1 parent 82b475c commit 4eb9fb0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion components/layout/nav/navbar-popover.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { collectEvent, EventName } from '@/lib/collect';
import React, { useCallback, useMemo } from 'react';
import Popover from '@/components/shared/popover';
import { navigation } from '@/lib/config/navigation';
Expand Down Expand Up @@ -48,7 +49,15 @@ function NavbarPopover({
{group.name === 'Download' && (
<div className={'w-full overflow-hidden whitespace-pre-wrap px-4 text-sm text-gray-400'}>
AppFlowy is now in{' '}
<Link className={'hover:text-primary underline'} href={'https://appflowy.com'}>
<Link
onClick={() => {
collectEvent(EventName.downloadBrowserBtn, {
type: 'click',
});
}}
className={'hover:text-primary underline'}
href={'https://appflowy.com'}
>
your browser
</Link>
</div>
Expand Down
4 changes: 3 additions & 1 deletion lib/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export enum EventName {
downloadIOSModalCancelBtn = 'download_ios_modal_cancel_btn',
downloadAndroidModalOkBtn = 'download_android_modal_ok_btn',
downloadAndroidModalCancelBtn = 'download_android_modal_cancel_btn',
downloadBrowserBtn = 'download_browser_btn',
}

export interface DownloadParams extends BaseParams {
Expand Down Expand Up @@ -50,7 +51,8 @@ export function collectEvent(
| EventName.downloadAndroidModalCancelBtn
| EventName.downloadIOSTestFlightBtn
| EventName.downloadAppleBtn
| EventName.downloadAndroidBtn,
| EventName.downloadAndroidBtn
| EventName.downloadBrowserBtn,
params: {
type: 'view' | 'click';
}
Expand Down

0 comments on commit 4eb9fb0

Please sign in to comment.