Skip to content

Commit c8a99e6

Browse files
authored
fix: ensure analytics events are only tracked when enabled (#507)
1 parent 768f854 commit c8a99e6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/analytics/utils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ export const isAnalyticsEnabled = (): boolean => {
3434
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3535
export const trackEvent = (eventName: string, properties: Record<string, any> = {}) => {
3636
try {
37-
track(eventName, properties, {
38-
user_id: getUserIdentifier() || 'unknown',
39-
})
37+
if (isAnalyticsEnabled()) {
38+
track(eventName, properties, {
39+
user_id: getUserIdentifier() || 'unknown',
40+
})
41+
}
4042
} catch (error) {
4143
// Silently fail to not disrupt dev server
4244
}

0 commit comments

Comments
 (0)