# Vercel Web Analytics Implementation
## Summary
Successfully implemented Vercel Web Analytics on all HTML pages in the MQL5 Trading Automation project.
## Changes Made
### Files Modified (5 files):
1. **index.html** (root) - Main landing page
2. **dashboard/index.html** - Dashboard view
3. **docs/index.html** - Documentation page
4. **offline.html** - PWA offline fallback page
5. **sw-inspector.html** - Service Worker inspection tool
### Implementation Details
Added Vercel Web Analytics tracking scripts to the `<head>` section of each HTML file:
```html
<script>
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
```
### Why This Approach?
- This is a plain HTML project (no JavaScript framework like React, Next.js, or Vue)
- Following the official Vercel Web Analytics guide for HTML sites
- The analytics script is added directly to HTML files without requiring any npm packages
- The `defer` attribute ensures the script doesn't block page rendering
- The `window.va` initialization allows analytics to be tracked even before the main script loads
## How It Works
1. The inline script creates a queue (`window.vaq`) that collects analytics calls
2. The deferred script (`/_vercel/insights/script.js`) is loaded asynchronously from Vercel's CDN
3. Once loaded, the script processes the queued analytics events
4. Analytics automatically tracks page views and user interactions
## Next Steps
To enable analytics on the deployed site:
1. Deploy this code to Vercel
2. Go to the Vercel dashboard for this project
3. Navigate to the **Analytics** tab
4. Click **Enable** to activate Web Analytics
5. After the next deployment, the `/_vercel/insights/*` routes will be available
6. Verify by checking the browser's Network tab for requests to `/_vercel/insights/view`
## Testing
To verify the implementation works:
- Deploy to Vercel
- Visit any page on the deployed site
- Open browser DevTools → Network tab
- Look for Fetch/XHR requests to `/_vercel/insights/view`
- These requests indicate analytics is tracking page views
## Notes
- No package.json changes needed (this is a static HTML site)
- No build process required
- Analytics will only work on the deployed Vercel site (not in local development)
- All 5 HTML pages now have tracking enabled for complete coverage
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>