Skip to content

Commit 5dca585

Browse files
committed
feat: update analytics user id provisioning
1 parent 95c4732 commit 5dca585

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/setupAnalytics.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createLogger } from '@logger';
33
import { type Socket, io } from 'socket.io-client';
44

55
const logger = createLogger('[Analytics]');
6-
const ANALYTIC_SERVER_URL = 'https://analytics.lucid.sanooj.is-a.dev';
6+
const ANALYTIC_SERVER_URL = 'http://localhost:3000';
77
const USER_ID_LOCAL_KEY = 'lucid:lyrics:userId';
88

99
type AnalyticType = 'theme' | 'lyrics_extension' | 'glassify_theme';
@@ -39,10 +39,8 @@ export async function setupAnalytics(
3939
return;
4040
}
4141

42-
const userId = getUserId() ?? undefined;
43-
4442
socket = io(`${ANALYTIC_SERVER_URL}/ws/users`, {
45-
auth: { type: TYPE, userId },
43+
auth: { type: TYPE },
4644
closeOnBeforeunload: true,
4745
});
4846

@@ -57,6 +55,9 @@ export async function setupAnalytics(
5755
const MAX_RETRIES = 3;
5856

5957
socket.on('connect', () => {
58+
const userId = getUserId() ?? undefined;
59+
socket?.emit('getUserId', userId);
60+
6061
logger.info('Connected');
6162
connectionAttempts = 0;
6263
});

0 commit comments

Comments
 (0)