Skip to content

Install and Configure Vercel Web Analytics - #47

Merged
zskbot merged 2 commits into
mainfrom
vercel/install-and-configure-vercel-w-0f4nud
Nov 16, 2026
Merged

zskbot merged 2 commits into
mainfrom
vercel/install-and-configure-vercel-w-0f4nud

Conversation

@vercel

@vercel vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Vercel Web Analytics Installation

Successfully installed and configured Vercel Web Analytics for this static HTML website.

Project Framework

This is a static HTML site hosted on GitHub Pages (not a Next.js or React project). The site uses plain HTML/CSS/JavaScript without a build process or package.json.

Implementation Approach

Following the latest Vercel Web Analytics documentation (November 2024), I used the CDN-based approach recommended for static sites:

<!-- Vercel Web Analytics -->
<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>

Files Modified

Added the Vercel Web Analytics script tag to all 6 HTML pages in the project:

  1. index.html - Main control center dashboard
  2. projects/index.html - Project registry page
  3. profile/preview.html - Profile UI preview page
  4. auth/index.html - Authentication page
  5. auth/ocodejs.html - OCodeJS auth variant
  6. security/token-vault/public/index.html - Token vault page

Key Points

  • No npm package required: For static HTML sites, the CDN approach (@vercel/analytics package is only needed for framework-based projects with build systems)
  • Placement: Added the script in the <head> section of each file, immediately after the existing Speed Insights script
  • Preserved existing code: The site already had Vercel Speed Insights configured (/_vercel/insights/script.js), which is a separate product from Web Analytics
  • Both services now active:
    • Speed Insights: monitors performance metrics (Core Web Vitals)
    • Web Analytics: tracks pageviews and custom events

Verification

Once deployed to Vercel, analytics will automatically start collecting:

  • Page views
  • User sessions
  • Navigation patterns
  • Custom events (if configured later)

Next Steps

After deployment, you can:

  1. Enable Web Analytics in your Vercel project dashboard (if not already enabled)
  2. View analytics data at vercel.com/[your-project]/analytics
  3. Configure custom events if needed using the window.va() function
  4. Set up audience segmentation filters

The implementation follows official Vercel documentation and best practices for static HTML sites.


View Project · Web Analytics

Created by page (webb10) with Vercel Agent

Summary by Sourcery

New Features:

  • Add Vercel Web Analytics tracking to all six static HTML pages.

## Vercel Web Analytics Installation

Successfully installed and configured Vercel Web Analytics for this static HTML website.

### Project Framework
This is a **static HTML site** hosted on GitHub Pages (not a Next.js or React project). The site uses plain HTML/CSS/JavaScript without a build process or package.json.

### Implementation Approach
Following the latest Vercel Web Analytics documentation (November 2024), I used the **CDN-based approach** recommended for static sites:

```html
<!-- Vercel Web Analytics -->
<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>
```

### Files Modified
Added the Vercel Web Analytics script tag to all 6 HTML pages in the project:

1. **index.html** - Main control center dashboard
2. **projects/index.html** - Project registry page
3. **profile/preview.html** - Profile UI preview page
4. **auth/index.html** - Authentication page
5. **auth/ocodejs.html** - OCodeJS auth variant
6. **security/token-vault/public/index.html** - Token vault page

### Key Points

- **No npm package required**: For static HTML sites, the CDN approach (`@vercel/analytics` package is only needed for framework-based projects with build systems)
- **Placement**: Added the script in the `<head>` section of each file, immediately after the existing Speed Insights script
- **Preserved existing code**: The site already had Vercel Speed Insights configured (`/_vercel/insights/script.js`), which is a separate product from Web Analytics
- **Both services now active**: 
  - Speed Insights: monitors performance metrics (Core Web Vitals)
  - Web Analytics: tracks pageviews and custom events

### Verification
Once deployed to Vercel, analytics will automatically start collecting:
- Page views
- User sessions
- Navigation patterns
- Custom events (if configured later)

### Next Steps
After deployment, you can:
1. Enable Web Analytics in your Vercel project dashboard (if not already enabled)
2. View analytics data at vercel.com/[your-project]/analytics
3. Configure custom events if needed using the `window.va()` function
4. Set up audience segmentation filters

The implementation follows official Vercel documentation and best practices for static HTML sites.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Project Deployment Actions Updated
ocodejs-profile Error Error Nov 16, 2026 8:45pm UTC
ocodejs.github.io Ready Ready Preview Nov 16, 2026 8:45pm UTC
pages.ocodejs.theme Ready Ready Preview Nov 16, 2026 8:45pm UTC

@sourcery-ai

sourcery-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

UI

Review the removed closing tags in the profile preview and projects pages, which may leave their HTML documents incomplete.

  • profile/preview.html L41 (removed lines)
  • projects/index.html L62 (removed lines)

Configuration

Add the Vercel Web Analytics CDN script to each static HTML page alongside the existing Speed Insights integration.

  • auth/index.html L63-64
  • auth/ocodejs.html L63-64
  • index.html L22-23
  • profile/preview.html L15-16
  • projects/index.html L18-19
  • security/token-vault/public/index.html L24-25

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@zskbot
zskbot marked this pull request as ready for review November 16, 2026 20:45
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T20:45:06.432935Z
We couldn’t complete this review. Comment @codex review to try again.
24b4ef4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@zskbot
zskbot merged commit 26fbb49 into main Nov 16, 2026
4 of 8 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="security/token-vault/public/index.html" line_range="25" />
<code_context>
 </script>
 <script defer src="/_vercel/insights/script.js"></script>
+<!-- Vercel Web Analytics -->
+<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>
 </head>
 <body>
</code_context>
<issue_to_address>
**Vault credentials can be exposed**

When the external analytics script is compromised or altered while a user signs in, the script runs with access to the page DOM and can capture and exfiltrate the master password, exposing the credentials it protects.

Do not load the third-party analytics script on the credential-entry page.

Also at `auth/index.html:64`, `auth/ocodejs.html:64`.
</issue_to_address>

### Comment 2
<location path="index.html" line_range="23" />
<code_context>
 </script>
 <script defer src="/_vercel/insights/script.js"></script>
+<!-- Vercel Web Analytics -->
+<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>
 </head>
 <body>
</code_context>
<issue_to_address>
**Production visits go untracked**

When the production site remains on GitHub Pages and the connected Vercel project is unbuildable because the repository lacks a root `package.json`, the generic CDN script has no GitHub Pages collection endpoint or project-specific association, so production visits do not appear in Vercel Analytics.

Configure analytics for the actual production host and a functioning project, or serve the site from that project.

Also at `projects/index.html:19`, `profile/preview.html:16`, `auth/index.html:64`, `auth/ocodejs.html:64`, `security/token-vault/public/index.html:25`.
</issue_to_address>

### Comment 3
<location path="index.html" line_range="23" />
<code_context>
 </script>
 <script defer src="/_vercel/insights/script.js"></script>
+<!-- Vercel Web Analytics -->
+<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>
 </head>
 <body>
</code_context>
<issue_to_address>
**Analytics counts are inflated**

When both the existing and CDN loaders execute on a page, `/_vercel/insights/script.js` and the CDN script both initialize tracking, recording duplicate pageviews and events and inflating dashboard totals.

Remove one loader so each page initializes Web Analytics only once.

Also at `projects/index.html:19`, `profile/preview.html:16`, `auth/index.html:64`, `auth/ocodejs.html:64`, `security/token-vault/public/index.html:25`.
</issue_to_address>

### Comment 4
<location path="security/token-vault/public/index.html" line_range="25" />
<code_context>
 </script>
 <script defer src="/_vercel/insights/script.js"></script>
+<!-- Vercel Web Analytics -->
+<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>
 </head>
 <body>
</code_context>
<issue_to_address>
**Worker visits go untracked**

When visitors use the deployed Token Vault Worker routes, the Worker serves embedded `LOGIN_HTML` and `VAULT_HTML` for `/` and `/vault`, not `public/index.html`, so the added script never loads and those visits are not tracked.

Add the analytics script to the HTML served by the Worker routes.
</issue_to_address>

### Comment 5
<location path="index.html" line_range="23" />
<code_context>
 </script>
 <script defer src="/_vercel/insights/script.js"></script>
+<!-- Vercel Web Analytics -->
+<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>
 </head>
 <body>
</code_context>
<issue_to_address>
**Dashboard sections go untracked**

When visitors navigate between dashboard sections, `navigate()` changes the rendered view without changing the URL or emitting an analytics event, so the script records the initial load but misses section visits.

Emit an analytics event when `navigate()` switches dashboard sections.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 5 findings to address first, and the added CDN script runs on auth and token-vault pages and can send page or referrer data to an external analytics service. Reverting stops future collection, but telemetry already sent cannot be recalled.

Blocking findings: security/token-vault/public/index.html:25, index.html:23, index.html:23, security/token-vault/public/index.html:25, index.html:23


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

</script>
<script defer src="/_vercel/insights/script.js"></script>
<!-- Vercel Web Analytics -->
<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Vault credentials can be exposed

When the external analytics script is compromised or altered while a user signs in, the script runs with access to the page DOM and can capture and exfiltrate the master password, exposing the credentials it protects.

Do not load the third-party analytics script on the credential-entry page.

Also at auth/index.html:64, auth/ocodejs.html:64.

Prompt for AI agents
In `security/token-vault/public/index.html` at line 25:

**Vault credentials can be exposed**

When the external analytics script is compromised or altered while a user signs in, the script runs with access to the page DOM and can capture and exfiltrate the master password, exposing the credentials it protects.

Do not load the third-party analytics script on the credential-entry page.

Also at `auth/index.html:64`, `auth/ocodejs.html:64`.

Comment thread index.html
</script>
<script defer src="/_vercel/insights/script.js"></script>
<!-- Vercel Web Analytics -->
<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Production visits go untracked

When the production site remains on GitHub Pages and the connected Vercel project is unbuildable because the repository lacks a root package.json, the generic CDN script has no GitHub Pages collection endpoint or project-specific association, so production visits do not appear in Vercel Analytics.

Configure analytics for the actual production host and a functioning project, or serve the site from that project.

Also at projects/index.html:19, profile/preview.html:16, auth/index.html:64, auth/ocodejs.html:64, security/token-vault/public/index.html:25.

Prompt for AI agents
In `index.html` at line 23:

**Production visits go untracked**

When the production site remains on GitHub Pages and the connected Vercel project is unbuildable because the repository lacks a root `package.json`, the generic CDN script has no GitHub Pages collection endpoint or project-specific association, so production visits do not appear in Vercel Analytics.

Configure analytics for the actual production host and a functioning project, or serve the site from that project.

Also at `projects/index.html:19`, `profile/preview.html:16`, `auth/index.html:64`, `auth/ocodejs.html:64`, `security/token-vault/public/index.html:25`.

Comment thread index.html
</script>
<script defer src="/_vercel/insights/script.js"></script>
<!-- Vercel Web Analytics -->
<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Analytics counts are inflated

When both the existing and CDN loaders execute on a page, /_vercel/insights/script.js and the CDN script both initialize tracking, recording duplicate pageviews and events and inflating dashboard totals.

Remove one loader so each page initializes Web Analytics only once.

Also at projects/index.html:19, profile/preview.html:16, auth/index.html:64, auth/ocodejs.html:64, security/token-vault/public/index.html:25.

Prompt for AI agents
In `index.html` at line 23:

**Analytics counts are inflated**

When both the existing and CDN loaders execute on a page, `/_vercel/insights/script.js` and the CDN script both initialize tracking, recording duplicate pageviews and events and inflating dashboard totals.

Remove one loader so each page initializes Web Analytics only once.

Also at `projects/index.html:19`, `profile/preview.html:16`, `auth/index.html:64`, `auth/ocodejs.html:64`, `security/token-vault/public/index.html:25`.

</script>
<script defer src="/_vercel/insights/script.js"></script>
<!-- Vercel Web Analytics -->
<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Worker visits go untracked

When visitors use the deployed Token Vault Worker routes, the Worker serves embedded LOGIN_HTML and VAULT_HTML for / and /vault, not public/index.html, so the added script never loads and those visits are not tracked.

Add the analytics script to the HTML served by the Worker routes.

Prompt for AI agents
In `security/token-vault/public/index.html` at line 25:

**Worker visits go untracked**

When visitors use the deployed Token Vault Worker routes, the Worker serves embedded `LOGIN_HTML` and `VAULT_HTML` for `/` and `/vault`, not `public/index.html`, so the added script never loads and those visits are not tracked.

Add the analytics script to the HTML served by the Worker routes.

Comment thread index.html
</script>
<script defer src="/_vercel/insights/script.js"></script>
<!-- Vercel Web Analytics -->
<script defer src="https://cdn.vercel-insights.com/v1/script.js"></script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Dashboard sections go untracked

When visitors navigate between dashboard sections, navigate() changes the rendered view without changing the URL or emitting an analytics event, so the script records the initial load but misses section visits.

Emit an analytics event when navigate() switches dashboard sections.

Prompt for AI agents
In `index.html` at line 23:

**Dashboard sections go untracked**

When visitors navigate between dashboard sections, `navigate()` changes the rendered view without changing the URL or emitting an analytics event, so the script records the initial load but misses section visits.

Emit an analytics event when `navigate()` switches dashboard sections.

This branch had an error being deployed

1 failed deployment
Preview – ocodejs-profile — 24b4ef45 Deployed Nov 16, 2026 by vercel[bot]
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