fix(analytics): pass the Clarity project id into the image build - #12
Conversation
Declare NEXT_PUBLIC_CLARITY_PROJECT_ID as a build arg in Dockerfile.dev and pass it from the Docker Hub workflow. Next.js inlines NEXT_PUBLIC_* values during the build, so the id has to be present when the image is compiled.
PR Summary by Qodofix(analytics): pass Clarity project id during Docker image build
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Hardcoded Clarity project id
|
Pass the Clarity project id into the image build
Microsoft Clarity was added to the frontend in #11, but the image build
never received the project id. Next.js replaces every
NEXT_PUBLIC_*expression with a literal string during
next build, so the compiledbundle carries whatever the value was at build time. With nothing passed,
the component's guard renders nothing and no sessions are recorded.
This is invisible from the outside. The build succeeds, the image ships,
the pod runs, and the dashboard stays empty with no error anywhere.
The workflow now passes the id as a build arg and the Dockerfile declares
it before the build step. The id is hardcoded rather than read from a
repository variable because it is already public in the page source of
every instrumented site, and this workflow only ever runs in this
repository.