@@ -5,7 +5,7 @@ import mixpanel from 'mixpanel-browser';
55const MIXPANEL_TOKEN = process . env . NEXT_PUBLIC_MIXPANEL_TOKEN ;
66const isClient = typeof window !== 'undefined' ;
77const isTestEnv = process . env . NODE_ENV === 'test' ;
8- const isProductionDomain = process . env . VERCEL_ENV === 'production' ;
8+ const isProduction = process . env . NODE_ENV === 'production' ;
99let isMixpanelInitialized = false ;
1010
1111export const initMixpanel = ( ) => {
@@ -14,7 +14,7 @@ export const initMixpanel = () => {
1414 return ;
1515 }
1616
17- if ( ! isMixpanelInitialized && isProductionDomain ) {
17+ if ( ! isMixpanelInitialized && isProduction ) {
1818 mixpanel . init ( MIXPANEL_TOKEN , {
1919 track_pageview : false ,
2020 persistence : 'localStorage' ,
@@ -27,15 +27,15 @@ export const initMixpanel = () => {
2727} ;
2828
2929export const startRecording = ( ) => {
30- if ( ! isClient || ! isProductionDomain ) {
30+ if ( ! isClient || ! isProduction ) {
3131 return ;
3232 }
3333
3434 mixpanel . start_session_recording ( ) ;
3535} ;
3636
3737export const stopRecording = ( ) => {
38- if ( ! isClient || ! isProductionDomain ) {
38+ if ( ! isClient || ! isProduction ) {
3939 return ;
4040 }
4141
@@ -49,7 +49,7 @@ export const stopRecording = () => {
4949 */
5050
5151export const trackEvent = ( event : string , properties ?: Record < string , any > ) => {
52- if ( ! isClient || isTestEnv || ! isProductionDomain ) return ;
52+ if ( ! isClient || isTestEnv || ! isProduction ) return ;
5353
5454 if ( ! MIXPANEL_TOKEN ) {
5555 console . warn ( 'Mixpanel Token is missing.' ) ;
@@ -66,7 +66,7 @@ export const trackEvent = (event: string, properties?: Record<string, any>) => {
6666 * @param userId 사용자 ID
6767 */
6868export const identifyUser = ( userId : string ) => {
69- if ( ! MIXPANEL_TOKEN || ! isClient || ! isProductionDomain ) return ;
69+ if ( ! MIXPANEL_TOKEN || ! isClient || ! isProduction ) return ;
7070
7171 try {
7272 mixpanel . identify ( userId ) ;
@@ -83,7 +83,7 @@ export const identifyUser = (userId: string) => {
8383 * @param properties 사용자 속성 데이터
8484 */
8585export const setUserProperties = ( properties : Record < string , string > ) => {
86- if ( ! MIXPANEL_TOKEN || ! isClient || ! isProductionDomain ) return ;
86+ if ( ! MIXPANEL_TOKEN || ! isClient || ! isProduction ) return ;
8787
8888 try {
8989 mixpanel . people . set ( properties ) ;
@@ -96,7 +96,7 @@ export const setUserProperties = (properties: Record<string, string>) => {
9696 * 사용자 로그아웃 (로그아웃 시 호출)
9797 */
9898export const logoutUser = ( ) => {
99- if ( ! MIXPANEL_TOKEN || ! isClient || ! isProductionDomain ) return ;
99+ if ( ! MIXPANEL_TOKEN || ! isClient || ! isProduction ) return ;
100100
101101 try {
102102 mixpanel . reset ( ) ;
0 commit comments