Skip to content

Add Vercel Web Analytics to project#188

Draft
vercel[bot] wants to merge 1 commit intomasterfrom
vercel/vercel-web-analytics-to-projec-hso48s
Draft

Add Vercel Web Analytics to project#188
vercel[bot] wants to merge 1 commit intomasterfrom
vercel/vercel-web-analytics-to-projec-hso48s

Conversation

@vercel
Copy link
Copy Markdown

@vercel vercel bot commented Jan 2, 2026

Vercel Web Analytics Integration Implementation

Summary

Successfully integrated Vercel Web Analytics into the Buildbot project. The implementation uses the HTML-based analytics approach, which is appropriate for the project's architecture.

Analysis

The Buildbot project consists of:

  • Backend: Python FastAPI-based master application (master/buildbot/)
  • Frontend: AngularJS-based web UI (www/base/) with webpack bundling and Jade templating

Since the frontend is not a modern framework (like Next.js, React App, etc.) but rather a traditional JavaScript application with Jade templates, the HTML implementation approach was chosen.

Changes Made

Modified Files:

  • www/base/src/app/layout.jade
    • Added Vercel Web Analytics script initialization
    • Added deferred script tag to load analytics from /_vercel/insights/script.js
    • Placement: Between browser warning scripts and app initialization scripts for optimal load timing

Implementation Details

The implementation adds two script elements to the HTML head:

  1. Analytics Function Initialization:

    <script>
      window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
    </script>

    This creates a queue-based function for analytics calls, ensuring functionality even if the analytics script loads asynchronously.

  2. Analytics Script Loading:

    <script defer src="/_vercel/insights/script.js"></script>

    The deferred attribute ensures the script loads after DOM parsing, preventing blocking of page rendering.

Why This Approach

  • No Package Installation Required: The HTML implementation doesn't require adding @vercel/analytics as a dependency
  • Works with Legacy Architecture: Compatible with AngularJS and webpack-based applications
  • CDN Delivery: The analytics script loads from Vercel's CDN at deployment time
  • Minimal Changes: Non-invasive integration with existing codebase
  • No Framework-Specific Code: Works regardless of framework changes

Prerequisites for Deployment

To enable analytics data collection:

  1. Project must be deployed to Vercel
  2. Web Analytics must be enabled on the Vercel dashboard
  3. No additional configuration needed - the script will automatically begin tracking once deployed

Data Collection

Once deployed to Vercel with Web Analytics enabled:

  • Automatic tracking of page views and visitor information
  • Network request monitoring available in browser DevTools
  • Requests will appear to /_vercel/insights/view endpoint
  • No route support in HTML implementation (standard for plain HTML apps)
  • Custom events can be added later using the analytics queue if needed

Testing Notes

  • Jade syntax validation: ✓ Passed
  • File structure: ✓ Verified
  • Indentation: ✓ Consistent with existing code
  • Script placement: ✓ Optimal for performance
  • No breaking changes: ✓ Confirmed

Notes

  • The analytics script only becomes active when deployed to Vercel
  • In local development, the /_vercel/insights/script.js will not be available (expected behavior)
  • The implementation follows Vercel's official documentation for HTML-based web analytics

View Project · Web Analytics

Created by Crystal_Alchemist (quantumblockchainai) with Vercel Agent

## Vercel Web Analytics Integration Implementation

### Summary
Successfully integrated Vercel Web Analytics into the Buildbot project. The implementation uses the HTML-based analytics approach, which is appropriate for the project's architecture.

### Analysis
The Buildbot project consists of:
- **Backend**: Python FastAPI-based master application (master/buildbot/)
- **Frontend**: AngularJS-based web UI (www/base/) with webpack bundling and Jade templating

Since the frontend is not a modern framework (like Next.js, React App, etc.) but rather a traditional JavaScript application with Jade templates, the HTML implementation approach was chosen.

### Changes Made

#### Modified Files:
- **www/base/src/app/layout.jade**
  - Added Vercel Web Analytics script initialization
  - Added deferred script tag to load analytics from `/_vercel/insights/script.js`
  - Placement: Between browser warning scripts and app initialization scripts for optimal load timing

### Implementation Details

The implementation adds two script elements to the HTML head:

1. **Analytics Function Initialization**:
   ```html
   <script>
     window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
   </script>
   ```
   This creates a queue-based function for analytics calls, ensuring functionality even if the analytics script loads asynchronously.

2. **Analytics Script Loading**:
   ```html
   <script defer src="/_vercel/insights/script.js"></script>
   ```
   The deferred attribute ensures the script loads after DOM parsing, preventing blocking of page rendering.

### Why This Approach

- **No Package Installation Required**: The HTML implementation doesn't require adding `@vercel/analytics` as a dependency
- **Works with Legacy Architecture**: Compatible with AngularJS and webpack-based applications
- **CDN Delivery**: The analytics script loads from Vercel's CDN at deployment time
- **Minimal Changes**: Non-invasive integration with existing codebase
- **No Framework-Specific Code**: Works regardless of framework changes

### Prerequisites for Deployment

To enable analytics data collection:
1. Project must be deployed to Vercel
2. Web Analytics must be enabled on the Vercel dashboard
3. No additional configuration needed - the script will automatically begin tracking once deployed

### Data Collection

Once deployed to Vercel with Web Analytics enabled:
- Automatic tracking of page views and visitor information
- Network request monitoring available in browser DevTools
- Requests will appear to `/_vercel/insights/view` endpoint
- No route support in HTML implementation (standard for plain HTML apps)
- Custom events can be added later using the analytics queue if needed

### Testing Notes

- Jade syntax validation: ✓ Passed
- File structure: ✓ Verified
- Indentation: ✓ Consistent with existing code
- Script placement: ✓ Optimal for performance
- No breaking changes: ✓ Confirmed

### Notes

- The analytics script only becomes active when deployed to Vercel
- In local development, the `/_vercel/insights/script.js` will not be available (expected behavior)
- The implementation follows Vercel's official documentation for HTML-based web analytics

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

vercel bot commented Jan 2, 2026

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

Project Deployment Actions Updated (UTC)
buildbot Error Error Mar 12, 2026 1:25am
csb-b6x6kw Ready Ready Preview, Comment Mar 12, 2026 1:25am

@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Jan 2, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 2, 2026

⚠️ No Changeset found

Latest commit: 786f1d1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

0 participants