MQL5-Google-Onedrive/offline.html
Vercel 85de722951 Enable Vercel Web Analytics for your project
# 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>
2026-02-25 15:12:16 +00:00

144 lines
3.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Offline - MQL5 Trading Automation</title>
<script>
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: linear-gradient(135deg, #4f46e5 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
background: white;
padding: 50px;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
text-align: center;
max-width: 500px;
}
.icon {
font-size: 80px;
margin-bottom: 20px;
}
h1 {
color: #333;
font-size: 2em;
margin-bottom: 15px;
}
p {
color: #666;
line-height: 1.6;
margin-bottom: 20px;
}
.btn {
display: inline-block;
padding: 12px 30px;
background: #4f46e5;
color: white;
text-decoration: none;
border-radius: 8px;
font-weight: 600;
transition: background 0.3s;
border: none;
cursor: pointer;
font-size: 1em;
}
.btn:hover {
background: #4338ca;
}
.status {
margin-top: 30px;
padding-top: 30px;
border-top: 1px solid #eee;
}
.status-text {
color: #888;
font-size: 0.9em;
}
.online {
color: #10b981;
font-weight: 600;
}
.offline {
color: #ef4444;
font-weight: 600;
}
</style>
</head>
<body>
<div class="container">
<div class="icon" role="img" aria-label="Satellite Antenna">📡</div>
<h1>You're Offline</h1>
<p>
It looks like you've lost your internet connection.
Don't worry, some features are still available offline.
</p>
<p>
This Progressive Web App will automatically reconnect when you're back online.
</p>
<button class="btn" onclick="location.reload()">Try Again</button>
<div class="status">
<div class="status-text">
Connection Status: <span id="status" class="offline">Offline</span>
</div>
</div>
</div>
<script>
// Update connection status
function updateStatus() {
const statusEl = document.getElementById('status');
if (navigator.onLine) {
statusEl.textContent = 'Online';
statusEl.className = 'online';
// Auto-reload when back online
setTimeout(() => location.reload(), 1000);
} else {
statusEl.textContent = 'Offline';
statusEl.className = 'offline';
}
}
// Listen for connection changes
window.addEventListener('online', updateStatus);
window.addEventListener('offline', updateStatus);
// Initial check
updateStatus();
// Periodic check
setInterval(() => {
if (navigator.onLine) {
updateStatus();
}
}, 5000);
</script>
</body>
</html>