Skip to content

Set Up Vercel Speed Insights for Your Project#2

Draft
vercel[bot] wants to merge 1 commit intomainfrom
vercel/set-up-vercel-speed-insights-f-afakaa
Draft

Set Up Vercel Speed Insights for Your Project#2
vercel[bot] wants to merge 1 commit intomainfrom
vercel/set-up-vercel-speed-insights-f-afakaa

Conversation

@vercel
Copy link

@vercel vercel bot commented Mar 9, 2026

Vercel Speed Insights Implementation Report

Summary

Successfully implemented Vercel Speed Insights for the AttendanceApp PHP application using the HTML implementation approach.

What Was Implemented

1. Created Shared Speed Insights Include File

  • File: includes/speed-insights.php
  • Contains the Vercel Speed Insights tracking script that loads /_vercel/speed-insights/script.js
  • Uses the standard HTML implementation with the window.si initialization function

2. Integrated Speed Insights Across All Application Pages

User-Facing Pages (5 files):

  • index.php - Login page
  • register.php - User registration page
  • forgot-password.php - Password reset page
  • dashboard.php - User attendance dashboard
  • profile.php - User profile management

Admin Pages (3 files):

  • admin/index.php - Admin dashboard with charts
  • admin/users.php - User management CRUD interface
  • admin/reports.php - Reports and export functionality

Installation Page (1 file):

  • install.php - Database installation wizard

3. Implementation Details

  • Added <?php include __DIR__ . '/includes/speed-insights.php'; ?> before the closing </body> tag on all HTML-rendering pages
  • Used relative path includes appropriate to each file's location (root-level files use __DIR__, admin files use __DIR__ . '/../')
  • Did NOT add to API endpoints (api/attendance.php) or utility files (logout.php, config.php, functions.php) as they don't render HTML

Files Created

  • /includes/speed-insights.php - Shared Speed Insights tracking script include

Files Modified

  1. index.php
  2. register.php
  3. forgot-password.php
  4. dashboard.php
  5. profile.php
  6. admin/index.php
  7. admin/users.php
  8. admin/reports.php
  9. install.php

Implementation Approach

Since this is a traditional PHP application (not a JavaScript framework like Next.js, React, or Vue), I used the HTML implementation method as documented in the Vercel Speed Insights guide:

<script>
  window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>

Next Steps for Deployment

  1. Deploy the application to Vercel
  2. Enable Speed Insights in the Vercel dashboard for this project
  3. After deployment, verify that /_vercel/speed-insights/script.js is accessible
  4. Monitor the Speed Insights dashboard after users visit the site

Technical Notes

  • The Speed Insights script is loaded with the defer attribute for optimal performance
  • The script will automatically track page performance metrics once the application is deployed to Vercel
  • No additional dependencies or package installations are required for the HTML implementation
  • The implementation follows Vercel's official documentation for non-framework HTML applications

View Project · Speed Insights

Created by Julio Jr (jrjulio174-4735) with Vercel Agent

# Vercel Speed Insights Implementation Report

## Summary
Successfully implemented Vercel Speed Insights for the AttendanceApp PHP application using the HTML implementation approach.

## What Was Implemented

### 1. Created Shared Speed Insights Include File
- **File**: `includes/speed-insights.php`
- Contains the Vercel Speed Insights tracking script that loads `/_vercel/speed-insights/script.js`
- Uses the standard HTML implementation with the window.si initialization function

### 2. Integrated Speed Insights Across All Application Pages

#### User-Facing Pages (5 files):
- `index.php` - Login page
- `register.php` - User registration page
- `forgot-password.php` - Password reset page
- `dashboard.php` - User attendance dashboard
- `profile.php` - User profile management

#### Admin Pages (3 files):
- `admin/index.php` - Admin dashboard with charts
- `admin/users.php` - User management CRUD interface
- `admin/reports.php` - Reports and export functionality

#### Installation Page (1 file):
- `install.php` - Database installation wizard

### 3. Implementation Details
- Added `<?php include __DIR__ . '/includes/speed-insights.php'; ?>` before the closing `</body>` tag on all HTML-rendering pages
- Used relative path includes appropriate to each file's location (root-level files use `__DIR__`, admin files use `__DIR__ . '/../'`)
- Did NOT add to API endpoints (`api/attendance.php`) or utility files (`logout.php`, `config.php`, `functions.php`) as they don't render HTML

## Files Created
- `/includes/speed-insights.php` - Shared Speed Insights tracking script include

## Files Modified
1. `index.php`
2. `register.php`
3. `forgot-password.php`
4. `dashboard.php`
5. `profile.php`
6. `admin/index.php`
7. `admin/users.php`
8. `admin/reports.php`
9. `install.php`

## Implementation Approach
Since this is a traditional PHP application (not a JavaScript framework like Next.js, React, or Vue), I used the HTML implementation method as documented in the Vercel Speed Insights guide:

```html
<script>
  window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
```

## Next Steps for Deployment
1. Deploy the application to Vercel
2. Enable Speed Insights in the Vercel dashboard for this project
3. After deployment, verify that `/_vercel/speed-insights/script.js` is accessible
4. Monitor the Speed Insights dashboard after users visit the site

## Technical Notes
- The Speed Insights script is loaded with the `defer` attribute for optimal performance
- The script will automatically track page performance metrics once the application is deployed to Vercel
- No additional dependencies or package installations are required for the HTML implementation
- The implementation follows Vercel's official documentation for non-framework HTML applications

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

vercel bot commented Mar 9, 2026

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

Project Deployment Actions Updated (UTC)
attendance-app Ready Ready Preview, Comment Mar 9, 2026 6:28am

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