Skip to content

Commit 51b0ced

Browse files
committed
feat: add analytics event handling for dashboard interactions
1 parent 430f378 commit 51b0ced

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export const ROUTES = {
152152
NODE_CAPACITY: 'k8s/capacity/node',
153153
RESOURCE_TEMPLATE: 'resource/template',
154154
ENVIRONMENT_DATA: 'global/environment-variables',
155+
DASHBOARD_EVENT: 'dashboard-event',
155156
} as const
156157

157158
export enum KEY_VALUE {

src/Shared/Analytics/analytics.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { get } from '@Common/API'
2+
import { ROUTES } from '@Common/Constants'
3+
import { ServerAnalyticsEventType } from './types'
4+
5+
export const handleSendAnalyticsEventToServer = async (eventType: ServerAnalyticsEventType) => {
6+
try {
7+
await get(`${ROUTES.DASHBOARD_EVENT}/${eventType}`)
8+
} catch {
9+
// Do nothing
10+
}
11+
}

src/Shared/Analytics/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './analytics'
2+
export * from './types'

src/Shared/Analytics/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export enum ServerAnalyticsEventType {
2+
GET_LICENSE_CLICKED = 'getLicenseClicked',
3+
}

src/Shared/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ export * from './Services'
2424
export * from './Store'
2525
export * from './Hooks'
2626
export * from './API'
27+
export * from './Analytics'

0 commit comments

Comments
 (0)