Files
gitignore/public/index.html
T
Vercel c973da26b3 Install Vercel Web Analytics
Implemented Vercel Web Analytics for this static HTML project.

## What was implemented:

### 1. Installed @vercel/analytics package
- Added `@vercel/analytics` version ^2.0.1 to the project dependencies
- Used npm to install the package as specified in package.json

### 2. Added Web Analytics script to public/index.html
- Fetched the latest installation instructions from https://vercel.com/docs/analytics/quickstart
- Identified this as a vanilla HTML/JavaScript static site (not using any framework)
- Added the appropriate analytics script tags according to Vercel's documentation for HTML sites:
  - Added initialization script: `window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };`
  - Added deferred script tag: `<script defer src="/_vercel/insights/script.js"></script>`
- Placed the analytics scripts at the end of the body tag, right after the existing Speed Insights scripts

### 3. Updated dependencies and lock files
- package.json now includes @vercel/analytics in dependencies
- package-lock.json was automatically updated by npm install
- Both files are staged for the pull request

## Implementation choices:

- **Framework detection**: Examined the project structure and confirmed it's a static HTML site with no build framework
- **Script placement**: Added Web Analytics scripts at the end of the body tag to avoid blocking page load, following the same pattern as the existing Speed Insights implementation
- **Documentation source**: Used official Vercel documentation (fetched fresh from https://vercel.com/docs/analytics/quickstart) to ensure the most up-to-date installation method
- **Vanilla HTML approach**: Used the HTML/JavaScript implementation method as specified in the docs for static sites

## Testing:

- Verified build script runs successfully (static site, no compilation needed)
- Verified lint script runs successfully (no linting configured, but script executes)
- Confirmed package.json and package-lock.json were properly updated with the new dependency
- Verified the HTML structure remains valid with the new script tags

## Next steps:

After this PR is merged and deployed to Vercel:
1. Enable Web Analytics in the Vercel dashboard by navigating to the Analytics section and clicking the Enable button
2. Verify analytics are working by checking browser Network tab for `/_vercel/insights/view` requests
3. Monitor the analytics dashboard to see visitor data

The project already had Speed Insights configured, and Web Analytics has been added following the same pattern for consistency.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
2026-08-31 23:26:06 +00:00

111 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A collection of useful .gitignore templates">
<title>gitignore - A collection of .gitignore templates</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
header {
background: #fff;
padding: 30px;
margin-bottom: 30px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1 {
color: #24292e;
margin-bottom: 10px;
}
p {
color: #586069;
margin-bottom: 15px;
}
.content {
background: #fff;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.button {
display: inline-block;
background: #0366d6;
color: #fff;
padding: 12px 24px;
text-decoration: none;
border-radius: 6px;
margin-top: 10px;
transition: background 0.2s;
}
.button:hover {
background: #0256c2;
}
footer {
margin-top: 30px;
padding: 20px;
text-align: center;
color: #586069;
}
</style>
</head>
<body>
<header>
<h1>🎯 gitignore</h1>
<p>A collection of useful .gitignore templates for various programming languages and frameworks.</p>
</header>
<div class="content">
<h2>About This Project</h2>
<p>
This is GitHub's collection of <code>.gitignore</code> file templates.
We use this list to populate the .gitignore template choosers available
in the GitHub.com interface when creating new repositories and files.
</p>
<h3>Quick Links</h3>
<p>
<a href="https://github.com/hanayimmee/gitignore" class="button" target="_blank" rel="noopener noreferrer">
View on GitHub
</a>
</p>
<h3>Resources</h3>
<ul style="margin-left: 20px; margin-top: 10px;">
<li><a href="https://git-scm.com/docs/gitignore">gitignore(5) manual page</a></li>
<li><a href="https://help.github.com/articles/ignoring-files">Ignoring Files article on GitHub Help</a></li>
<li><a href="https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring">Pro Git book - Ignoring Files chapter</a></li>
</ul>
</div>
<footer>
<p>Licensed under <a href="https://github.com/hanayimmee/gitignore/blob/main/LICENSE">CC0-1.0</a></p>
</footer>
<!-- Vercel Speed Insights -->
<script>
window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
<!-- Vercel Web Analytics -->
<script>
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
</body>
</html>