Skip to content

docs(clarity): document env var name and call out common mistake#774

Closed
harlan-zw wants to merge 1 commit into
mainfrom
docs/clarity-env-var-naming
Closed

docs(clarity): document env var name and call out common mistake#774
harlan-zw wants to merge 1 commit into
mainfrom
docs/clarity-env-var-naming

Conversation

@harlan-zw

@harlan-zw harlan-zw commented May 14, 2026

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Resolves #769

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

The reporter set NUXT_PUBLIC_SCRIPTS_MICROSOFT_CLARITY_ID=... and expected it to populate scripts.clarity.id. That env var doesn't match any runtimeConfig path (public.scripts.clarity.idNUXT_PUBLIC_SCRIPTS_CLARITY_ID), so the id serialized as "". The auto env-default population added in #762 already reads the correct key for Clarity (envDefaults: { id: '' } in registry.ts), so no code change is needed; this is a docs/discoverability gap.

Adds an Environment Variables section to the Clarity docs (was missing, unlike Crisp / Intercom / GTM) and explicitly calls out that the env var follows the registry key (clarity), not the marketing name.

Add an environment variables section to the Clarity docs showing the
correct `NUXT_PUBLIC_SCRIPTS_CLARITY_ID` env var (registry key is
`clarity`, not `microsoftClarity`), matching the convention used by
other registry entries. Closes #769.
@vercel

vercel Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scripts-playground Ready Ready Preview, Comment May 14, 2026 4:58am

@pkg-pr-new

pkg-pr-new Bot commented May 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts@774

commit: 820c051

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the Clarity documentation to include a new "With Environment Variables" section. The addition clarifies how to configure the Clarity project ID via an environment variable using the registry-derived key name NUXT_PUBLIC_SCRIPTS_CLARITY_ID. It provides concrete examples of the nuxt.config.ts registry configuration and corresponding .env entry, along with a warning to ensure developers use the correct environment variable naming convention.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding documentation for the Clarity environment variable naming and highlighting the common mistake of using the marketing name instead of the registry key.
Linked Issues check ✅ Passed The PR directly addresses the root cause of issue #769 by documenting the correct environment variable name (NUXT_PUBLIC_SCRIPTS_CLARITY_ID instead of NUXT_PUBLIC_SCRIPTS_MICROSOFT_CLARITY_ID) with an explicit warning about this common mistake.
Out of Scope Changes check ✅ Passed The changes are scoped appropriately to documentation only (docs/content/scripts/clarity.md), adding the missing Environment Variables section while noting that no code changes are required since the infrastructure is already in place.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly explains the purpose: adding documentation about the correct environment variable naming convention for Clarity, distinguishing between the registry key and marketing name.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/clarity-env-var-naming

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@harlan-zw

Copy link
Copy Markdown
Collaborator Author

Closing - the Environment Variables tab in ScriptDocs.vue already auto-generates this from the registry (NUXT_PUBLIC_SCRIPTS_CLARITY_ID). The reporter's confusion in #769 was using the marketing name instead of the registry key, but the correct env var is already shown in the rendered docs. No code or docs change needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarity Id is empty string in production docker image

1 participant