feat: add registration and create_app tracking

This commit is contained in:
CodingOnStar 2025-11-14 14:40:53 +08:00
parent adf8ae79d5
commit 1416d71ece
10 changed files with 11 additions and 23 deletions

View File

@ -144,12 +144,12 @@ const Apps = ({
}) })
// Track app creation from template // Track app creation from template
trackEvent('app_created', { trackEvent('create_app_with_template', {
app_mode: mode, app_mode: mode,
creation_method: 'template',
template_id: currApp?.app.id, template_id: currApp?.app.id,
template_name: currApp?.app.name, template_name: currApp?.app.name,
has_description: !!description, time: new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }),
has_description: description,
}) })
setIsShowCreateModal(false) setIsShowCreateModal(false)

View File

@ -85,10 +85,10 @@ function CreateApp({ onClose, onSuccess, onCreateFromTemplate, defaultAppMode }:
}) })
// Track app creation success // Track app creation success
trackEvent('app_created', { trackEvent('create_app', {
app_mode: appMode, app_mode: appMode,
creation_method: 'blank', time: new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }),
has_description: !!description, description,
}) })
notify({ type: 'success', message: t('app.newApp.appCreated') }) notify({ type: 'success', message: t('app.newApp.appCreated') })

View File

@ -114,7 +114,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
const { id, status, app_id, app_mode, imported_dsl_version, current_dsl_version } = response const { id, status, app_id, app_mode, imported_dsl_version, current_dsl_version } = response
if (status === DSLImportStatus.COMPLETED || status === DSLImportStatus.COMPLETED_WITH_WARNINGS) { if (status === DSLImportStatus.COMPLETED || status === DSLImportStatus.COMPLETED_WITH_WARNINGS) {
// Track app creation from DSL import // Track app creation from DSL import
trackEvent('app_created', { trackEvent('create_app_with_dsl', {
app_mode, app_mode,
creation_method: currentTab === CreateFromDSLModalTab.FROM_FILE ? 'dsl_file' : 'dsl_url', creation_method: currentTab === CreateFromDSLModalTab.FROM_FILE ? 'dsl_file' : 'dsl_url',
has_warnings: status === DSLImportStatus.COMPLETED_WITH_WARNINGS, has_warnings: status === DSLImportStatus.COMPLETED_WITH_WARNINGS,

View File

@ -8,7 +8,6 @@ import quarterOfYear from 'dayjs/plugin/quarterOfYear'
import type { QueryParam } from './index' import type { QueryParam } from './index'
import Chip from '@/app/components/base/chip' import Chip from '@/app/components/base/chip'
import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import { trackEvent } from '../../base/amplitude/utils'
dayjs.extend(quarterOfYear) dayjs.extend(quarterOfYear)
const today = dayjs() const today = dayjs()
@ -38,9 +37,6 @@ const Filter: FC<IFilterProps> = ({ queryParams, setQueryParams }: IFilterProps)
value={queryParams.status || 'all'} value={queryParams.status || 'all'}
onSelect={(item) => { onSelect={(item) => {
setQueryParams({ ...queryParams, status: item.value as string }) setQueryParams({ ...queryParams, status: item.value as string })
trackEvent('workflow_log_filter_status_selected', {
workflow_log_filter_status: item.value as string,
})
}} }}
onClear={() => setQueryParams({ ...queryParams, status: 'all' })} onClear={() => setQueryParams({ ...queryParams, status: 'all' })}
items={[{ value: 'all', name: 'All' }, items={[{ value: 'all', name: 'All' },

View File

@ -27,7 +27,7 @@ const AmplitudeProvider: FC<IAmplitudeProps> = ({
fileDownloads: true, fileDownloads: true,
}, },
// Enable debug logs in development environment // Enable debug logs in development environment
logLevel: process.env.NODE_ENV === 'development' ? amplitude.Types.LogLevel.Debug : amplitude.Types.LogLevel.Warn, logLevel: amplitude.Types.LogLevel.Warn,
}) })
// Log initialization success in development // Log initialization success in development

View File

@ -19,7 +19,6 @@ import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/c
import useDocumentTitle from '@/hooks/use-document-title' import useDocumentTitle from '@/hooks/use-document-title'
import { useDocLink } from '@/context/i18n' import { useDocLink } from '@/context/i18n'
import { validPassword } from '@/config' import { validPassword } from '@/config'
import { trackEvent } from '@/app/components/base/amplitude'
const accountFormSchema = z.object({ const accountFormSchema = z.object({
email: z email: z
@ -74,15 +73,6 @@ const InstallForm = () => {
// Store tokens and redirect to apps if login successful // Store tokens and redirect to apps if login successful
if (loginRes.result === 'success') { if (loginRes.result === 'success') {
// Track initial setup completion
trackEvent('user_registration_success', {
method: 'initial_setup',
})
trackEvent('user_login_success', {
method: 'initial_setup',
is_invite: false,
})
router.replace('/apps') router.replace('/apps')
} }
else { else {

View File

@ -48,6 +48,7 @@ export default function CheckCode() {
// Track login success event // Track login success event
trackEvent('user_login_success', { trackEvent('user_login_success', {
method: 'email_code', method: 'email_code',
time: new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }),
is_invite: !!invite_token, is_invite: !!invite_token,
}) })

View File

@ -67,6 +67,7 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegis
// Track login success event // Track login success event
trackEvent('user_login_success', { trackEvent('user_login_success', {
method: 'email_password', method: 'email_password',
time: new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }),
is_invite: isInvite, is_invite: isInvite,
}) })

View File

@ -42,7 +42,6 @@ export default function CheckCode() {
} }
setIsLoading(true) setIsLoading(true)
const res = await verifyCode({ email, code, token }) const res = await verifyCode({ email, code, token })
console.log(res)
if ((res as MailValidityResponse).is_valid) { if ((res as MailValidityResponse).is_valid) {
const params = new URLSearchParams(searchParams) const params = new URLSearchParams(searchParams)
params.set('token', encodeURIComponent((res as MailValidityResponse).token)) params.set('token', encodeURIComponent((res as MailValidityResponse).token))

View File

@ -58,6 +58,7 @@ const ChangePasswordForm = () => {
// Track registration success event // Track registration success event
trackEvent('user_registration_success', { trackEvent('user_registration_success', {
method: 'email', method: 'email',
time: new Date().toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' }),
}) })
Toast.notify({ Toast.notify({