From fd3a7365f0edbb1ca2736b09008ee7891638ebbc Mon Sep 17 00:00:00 2001 From: Yunus A M Date: Mon, 25 Sep 2023 18:56:26 +0530 Subject: [PATCH] feat: add clarity ms --- frontend/src/AppRoutes/index.tsx | 2 + frontend/src/index.html.ejs | 359 ++++++++++++++++--------------- frontend/src/typings/window.ts | 3 + frontend/webpack.config.js | 2 + frontend/webpack.config.prod.js | 2 + 5 files changed, 198 insertions(+), 170 deletions(-) diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx index 38874ccd2a2..56ba19fdf49 100644 --- a/frontend/src/AppRoutes/index.tsx +++ b/frontend/src/AppRoutes/index.tsx @@ -93,6 +93,8 @@ function App(): JSX.Element { email: user?.email, name: user?.name, }); + + window.clarity('identify', user.email, user.name); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoggedInState, user]); diff --git a/frontend/src/index.html.ejs b/frontend/src/index.html.ejs index 8fe2ea80bbd..abfd8258bb9 100644 --- a/frontend/src/index.html.ejs +++ b/frontend/src/index.html.ejs @@ -1,170 +1,189 @@ - - - - - - - - - - Open source Observability platform | SigNoz - - - - - - - - - - - - - - - - - -
- - - - - - + + + + + + + + + + Open source Observability platform | SigNoz + + + + + + + + + + + + + + + + + +
+ + + + + + + + diff --git a/frontend/src/typings/window.ts b/frontend/src/typings/window.ts index a05152e5a52..02197e24446 100644 --- a/frontend/src/typings/window.ts +++ b/frontend/src/typings/window.ts @@ -1,8 +1,11 @@ import { compose, Store } from 'redux'; +type ClarityType = (...args: string[]) => T; + declare global { interface Window { store: Store; + clarity: ClarityType; analytics: Record; __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: typeof compose; } diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index 8690e5e55f5..5fe07bfa87f 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -21,6 +21,7 @@ const plugins = [ template: 'src/index.html.ejs', INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, SEGMENT_ID: process.env.SEGMENT_ID, + CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, }), new webpack.ProvidePlugin({ process: 'process/browser', @@ -31,6 +32,7 @@ const plugins = [ FRONTEND_API_ENDPOINT: process.env.FRONTEND_API_ENDPOINT, INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, SEGMENT_ID: process.env.SEGMENT_ID, + CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, }), }), ]; diff --git a/frontend/webpack.config.prod.js b/frontend/webpack.config.prod.js index b35c471fff5..c75ea529448 100644 --- a/frontend/webpack.config.prod.js +++ b/frontend/webpack.config.prod.js @@ -25,6 +25,7 @@ const plugins = [ template: 'src/index.html.ejs', INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, SEGMENT_ID: process.env.SEGMENT_ID, + CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, }), new CompressionPlugin({ exclude: /.map$/, @@ -40,6 +41,7 @@ const plugins = [ FRONTEND_API_ENDPOINT: process.env.FRONTEND_API_ENDPOINT, INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, SEGMENT_ID: process.env.SEGMENT_ID, + CLARITY_PROJECT_ID: process.env.CLARITY_PROJECT_ID, }), }), new MiniCssExtractPlugin(),