Skip to content

Commit

Permalink
feat: analytics events
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Zakharov committed Aug 26, 2023
1 parent f63ac10 commit 5e499a2
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/pages/appointment-create/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ import { createMutation, createQuery } from '@farfetched/core'
import { chainAppLoaded } from '@routing/chains'
import { routes } from '@routing/shared'
import { WebAppApi } from '@shared/api'
import { Consulate } from '@shared/api/webapp/types'
import { MutationTools, QueryTools } from '@shared/lib/farfetched'
import { combine, createEvent, createStore, restore, sample } from 'effector'
import { debug, reset } from 'patronum'
import {
combine,
createEffect,
createEvent,
createStore,
restore,
sample,
} from 'effector'
import { H } from 'highlight.run'
import { reset } from 'patronum'
import { FormValues } from './types'

export enum View {
Expand Down Expand Up @@ -155,3 +164,21 @@ sample({
filter: Boolean,
target: appointmentCreateMutation.start,
})

sample({
clock: appLoadedRoute.opened,
target: createEffect(() => {
H.track('Appointment Create Page Opened')
}),
})

sample({
clock: appointmentCreateMutation.finished.success,
source: $selectedConsulate,
filter: Boolean,
target: createEffect(({ country, city }: Consulate) => {
H.track('Appointment Created', {
consulate: `${country}, ${city}`,
})
}),
})

0 comments on commit 5e499a2

Please sign in to comment.