From 7c34424c04e631a216699600cc5079bdf4a505d0 Mon Sep 17 00:00:00 2001 From: wobsoriano Date: Thu, 23 Jul 2026 15:20:49 -0700 Subject: [PATCH 1/2] feat(shared): Support CLERK_TELEMETRY_NOTICE_DISABLED to suppress telemetry notice --- .../src/__tests__/telemetry.notice.spec.ts | 26 +++++++++++++++++++ packages/shared/src/telemetry/notice.ts | 14 +++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/__tests__/telemetry.notice.spec.ts b/packages/shared/src/__tests__/telemetry.notice.spec.ts index ec34a3cfbfb..176ae5eb716 100644 --- a/packages/shared/src/__tests__/telemetry.notice.spec.ts +++ b/packages/shared/src/__tests__/telemetry.notice.spec.ts @@ -21,12 +21,14 @@ describe('maybeShowTelemetryNotice', () => { beforeEach(() => { originalCIEnv = Object.fromEntries(CI_VARS.map(name => [name, process.env[name]])); clearCIEnv(); + delete process.env.CLERK_TELEMETRY_NOTICE_DISABLED; __resetTelemetryNoticeForTests(); logSpy = vi.spyOn(console, 'log').mockImplementation(() => {}); }); afterEach(() => { logSpy.mockRestore(); + delete process.env.CLERK_TELEMETRY_NOTICE_DISABLED; for (const [name, value] of Object.entries(originalCIEnv)) { if (typeof value === 'string') { process.env[name] = value; @@ -111,4 +113,28 @@ describe('maybeShowTelemetryNotice', () => { expect(() => maybeShowTelemetryNotice()).not.toThrow(); }); + + test('skips when CLERK_TELEMETRY_NOTICE_DISABLED is set to 1', () => { + process.env.CLERK_TELEMETRY_NOTICE_DISABLED = '1'; + + maybeShowTelemetryNotice(); + + expect(logSpy).not.toHaveBeenCalled(); + }); + + test('skips when CLERK_TELEMETRY_NOTICE_DISABLED is set to true', () => { + process.env.CLERK_TELEMETRY_NOTICE_DISABLED = 'true'; + + maybeShowTelemetryNotice(); + + expect(logSpy).not.toHaveBeenCalled(); + }); + + test('still prints when CLERK_TELEMETRY_NOTICE_DISABLED is falsy', () => { + process.env.CLERK_TELEMETRY_NOTICE_DISABLED = 'false'; + + maybeShowTelemetryNotice(); + + expect(logSpy).toHaveBeenCalled(); + }); }); diff --git a/packages/shared/src/telemetry/notice.ts b/packages/shared/src/telemetry/notice.ts index 17d9492758a..de9d1037e94 100644 --- a/packages/shared/src/telemetry/notice.ts +++ b/packages/shared/src/telemetry/notice.ts @@ -15,7 +15,8 @@ * delta is small. Authoritative disclosure for those setups lives in the Clerk * telemetry docs (https://clerk.com/docs/telemetry). Opt-out continues to work the * same way (`telemetry={false}` on `` or the framework-specific - * `*_CLERK_TELEMETRY_DISABLED` env var). + * `*_CLERK_TELEMETRY_DISABLED` env var). Users who keep telemetry enabled can suppress + * just this notice with `CLERK_TELEMETRY_NOTICE_DISABLED=1`. * * Persistence is in-process via a `globalThis` Symbol, which survives Next.js HMR * module reloads. No filesystem access, no `node:` imports, no dynamic-code APIs, so @@ -61,6 +62,14 @@ function isCI(): boolean { return automatedEnvironmentVariables.some(name => isTruthy(process.env[name])); } +// Silences only the notice, unlike CLERK_TELEMETRY_DISABLED which also turns off collection. +function isNoticeDisabled(): boolean { + if (typeof process === 'undefined' || !process.env) { + return false; + } + return isTruthy(process.env.CLERK_TELEMETRY_NOTICE_DISABLED); +} + function hasSeen(): boolean { return Boolean((globalThis as Record)[PROCESS_FLAG]); } @@ -103,6 +112,9 @@ export function maybeShowTelemetryNotice(options: MaybeShowTelemetryNoticeOption if (isCI()) { return; } + if (isNoticeDisabled()) { + return; + } if (hasSeen()) { return; } From b3dd503a252e4a235e70e4c94e41705fa3b50b02 Mon Sep 17 00:00:00 2001 From: wobsoriano Date: Thu, 23 Jul 2026 15:24:06 -0700 Subject: [PATCH 2/2] chore(repo): Add changeset --- .changeset/telemetry-notice-disabled.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/telemetry-notice-disabled.md diff --git a/.changeset/telemetry-notice-disabled.md b/.changeset/telemetry-notice-disabled.md new file mode 100644 index 00000000000..a04a8335603 --- /dev/null +++ b/.changeset/telemetry-notice-disabled.md @@ -0,0 +1,5 @@ +--- +'@clerk/shared': patch +--- + +Add support for the `CLERK_TELEMETRY_NOTICE_DISABLED` environment variable. Setting it to `1` (or `true`) suppresses the telemetry disclosure notice printed on dev-server startup while keeping telemetry collection enabled, for users who are okay with telemetry and no longer want the reminder. To disable telemetry collection itself (which also suppresses the notice), continue using `CLERK_TELEMETRY_DISABLED`.