From 1b9ebaf084ee8f402ac783dbef7d8a4a0f166788 Mon Sep 17 00:00:00 2001 From: Ridwa Date: Tue, 16 Jul 2024 16:29:30 +0530 Subject: [PATCH] Improved: removed console logs(#285) --- src/mixins/analytics.ts | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/mixins/analytics.ts b/src/mixins/analytics.ts index 45ccb36..1f10678 100644 --- a/src/mixins/analytics.ts +++ b/src/mixins/analytics.ts @@ -1,5 +1,3 @@ -// composables/useAnalytics.ts - import { onMounted, onBeforeUnmount } from 'vue'; import mixpanel from 'mixpanel-browser'; import { appContext } from '../index'; @@ -7,7 +5,7 @@ import { appContext } from '../index'; interface TrackableMetadata { label?: string; id?: string; - [key: string]: any; // Allow other properties as well + [key: string]: any; } function useAnalytics() { @@ -29,8 +27,6 @@ function useAnalytics() { const buttonLabel = metadata.label || button.innerText || button.getAttribute('aria-label') || 'Unnamed button'; const buttonId = button.id || metadata.id || 'no-id'; - console.log('Trackable Button Clicked:', { label: buttonLabel, id: buttonId }); - mixpanel.track(buttonLabel, { label: buttonLabel, id: buttonId, @@ -45,31 +41,15 @@ function useAnalytics() { try { mixpanel.init('5d1a58b28169000ca197c14274eddf87', { debug: true }); - console.log('Mixpanel initialized'); } catch (error) { - console.error('Error initializing Mixpanel:', error); return; } const appState = appContext.config.globalProperties.$store; - - if (!appState) { - console.error('appState is not defined'); - return; - } - const userProfile = appState.getters['user/getUserProfile']; - - if (!userProfile) { - console.error('userProfile is not defined'); - return; - } - const userEmail = userProfile.email; const userID = userProfile.userLoginId; - console.log('User Profile:', { userID, userEmail }); - try { mixpanel.identify(userID); mixpanel.people.set({ @@ -77,17 +57,14 @@ function useAnalytics() { $userId: userID, }); } catch (error) { - console.error('Error identifying user in Mixpanel:', error); return; } document.addEventListener('click', handleButtonClick); - console.log('Event listener added for button clicks'); }); onBeforeUnmount(() => { document.removeEventListener('click', handleButtonClick); - console.log('Event listener removed for button clicks'); }); }