Skip to content

fix(docs): load Promptwatch analytics via next/script#7683

Open
aidankmcalister wants to merge 2 commits intomainfrom
docs/promptwatch-visitor-analytics
Open

fix(docs): load Promptwatch analytics via next/script#7683
aidankmcalister wants to merge 2 commits intomainfrom
docs/promptwatch-visitor-analytics

Conversation

@aidankmcalister
Copy link
Member

@aidankmcalister aidankmcalister commented Mar 20, 2026

Summary by CodeRabbit

  • Chores
    • Added an additional client-side script that loads after the page becomes interactive.
    • Updated an existing client-side script to include a cookie-consent attribute for alignment with site consent settings.

@vercel
Copy link

vercel bot commented Mar 20, 2026

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

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Mar 20, 2026 6:56pm
docs Ready Ready Preview, Comment Mar 20, 2026 6:56pm
eclipse Ready Ready Preview, Comment Mar 20, 2026 6:56pm
site Ready Ready Preview, Comment Mar 20, 2026 6:56pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fdc30bdf-c2cf-4bdc-8831-52af466a0844

📥 Commits

Reviewing files that changed from the base of the PR and between 2091afe and fa2effc.

📒 Files selected for processing (1)
  • apps/docs/src/app/layout.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/docs/src/app/layout.tsx

Walkthrough

Added a second third-party script tag to the docs app root layout to load PromptWatch (https://ingest.promptwatch.com/js/client.min.js) with afterInteractive strategy and a project ID; also added data-cookieyes="cookieyes-analytics" to the existing Tolt script tag.

Changes

Cohort / File(s) Summary
Script Injection
apps/docs/src/app/layout.tsx
Inserted a Next.js Script loading PromptWatch (ingest.promptwatch.com/js/client.min.js) with strategy="afterInteractive" and data-project-id="25f18e15-6306-4faa-b5c2-8078804778ac". Added data-cookieyes="cookieyes-analytics" attribute to the existing Tolt script (https://cdn.tolt.io/tolt.js).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Principal Notes

While this change is mechanically simple, I'd recommend pausing to consider a few foundational concerns:

Security & Privacy: External script injection creates a trust boundary—ensure the PromptWatch domain and its script are verified as legitimate and maintained. This introduces a third-party dependency on runtime behavior.

Performance Impact: The afterInteractive strategy defers loading until after the page becomes interactive, which is sensible, but verify that the 30+ KB script doesn't create unintended CLS or layout shifts.

Error Resilience: There's no error handling if the external resource fails to load or is blocked. Consider whether monitoring failures should gracefully degrade or if they warrant observability themselves.

Scope Clarity: Confirm whether this monitoring should apply only to the docs app or if it will affect other applications in the monorepo.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: loading Promptwatch analytics via next/script in the docs app.

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


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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/docs/src/app/layout.tsx`:
- Around line 44-48: Update the PromptWatch <Script> element in layout.tsx (the
Script that loads https://ingest.promptwatch.com/js/client.min.js) to include
the CookieYes consent attribute data-cookieyes="cookieyes-analytics" so the
script only executes after analytics consent; modify the existing Script props
for that component (keep strategy and data-project-id) and also review the
Tolt.io <Script> (the one loading the tolt.io snippet) to determine if it needs
the same data-cookieyes gating and add it if appropriate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 824a418a-0c4c-4aed-8537-dfb8e860947c

📥 Commits

Reviewing files that changed from the base of the PR and between 41f47d8 and 2091afe.

📒 Files selected for processing (1)
  • apps/docs/src/app/layout.tsx

@argos-ci
Copy link

argos-ci bot commented Mar 20, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Mar 20, 2026, 7:02 PM

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.

1 participant