Skip to content

Commit 6888369

Browse files
chore: disable PostHog telemetry in development mode (#1365)
* chore: disable PostHog telemetry in development mode Skip posthog.init() when import.meta.env.DEV is true to avoid sending telemetry data during local development. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Rin <shinohara-rin@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 623f35a commit 6888369

4 files changed

Lines changed: 20 additions & 16 deletions

File tree

apps/stage-pocket/src/modules/posthog.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import posthog from 'posthog-js'
22

33
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_POCKET } from '../../../../posthog.config'
44

5-
posthog.init(POSTHOG_PROJECT_KEY_POCKET, {
6-
...DEFAULT_POSTHOG_CONFIG,
7-
// Project-specific config...
8-
})
5+
if (!import.meta.env.DEV) {
6+
posthog.init(POSTHOG_PROJECT_KEY_POCKET, {
7+
...DEFAULT_POSTHOG_CONFIG,
8+
})
9+
}

apps/stage-tamagotchi/src/renderer/modules/posthog.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import posthog from 'posthog-js'
22

33
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_DESKTOP } from '../../../../../posthog.config'
44

5-
posthog.init(POSTHOG_PROJECT_KEY_DESKTOP, {
6-
...DEFAULT_POSTHOG_CONFIG,
7-
// Project-specific config...
8-
})
5+
if (!import.meta.env.DEV) {
6+
posthog.init(POSTHOG_PROJECT_KEY_DESKTOP, {
7+
...DEFAULT_POSTHOG_CONFIG,
8+
})
9+
}

apps/stage-web/src/modules/posthog.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import posthog from 'posthog-js'
22

33
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_WEB } from '../../../../posthog.config'
44

5-
posthog.init(POSTHOG_PROJECT_KEY_WEB, {
6-
...DEFAULT_POSTHOG_CONFIG,
7-
// Project-specific config...
8-
})
5+
if (!import.meta.env.DEV) {
6+
posthog.init(POSTHOG_PROJECT_KEY_WEB, {
7+
...DEFAULT_POSTHOG_CONFIG,
8+
})
9+
}

docs/.vitepress/modules/posthog.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import posthog from 'posthog-js'
22

33
import { DEFAULT_POSTHOG_CONFIG, POSTHOG_PROJECT_KEY_DOCS } from '../../../posthog.config'
44

5-
posthog.init(POSTHOG_PROJECT_KEY_DOCS, {
6-
...DEFAULT_POSTHOG_CONFIG,
7-
// Project-specific config...
8-
})
5+
if (!import.meta.env.DEV) {
6+
posthog.init(POSTHOG_PROJECT_KEY_DOCS, {
7+
...DEFAULT_POSTHOG_CONFIG,
8+
})
9+
}

0 commit comments

Comments
 (0)