Repository navigation
Install Vercel Web Analytics - #2
Merged
Merged
Conversation
Implemented Vercel Web Analytics for the OCode.js documentation site. ## Changes Made ### Modified Files: 1. **index.html** - Added Vercel Web Analytics tracking script before closing </head> tag 2. **chatbot.html** - Added Vercel Web Analytics tracking script before closing </head> tag ### Implementation Details: Following the official Vercel Web Analytics quickstart documentation (https://vercel.com/docs/analytics/quickstart), I implemented analytics for this Jekyll-based static site using the vanilla JavaScript/HTML approach. Added the following scripts to both HTML files just before the closing `</head>` tag: ```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: 1. **Framework Detection**: The project uses Jekyll (identified from `_config.yml` and `vercel.json`) which is a static site generator. The site is built with plain HTML files. 2. **Vanilla JS Implementation**: According to Vercel's documentation, for vanilla JavaScript/HTML projects, the analytics script should be added directly to HTML files. 3. **Files Modified**: I added the script to both main HTML entry points: - `index.html` - The main documentation page - `chatbot.html` - The chatbot interface page 4. **Script Placement**: The scripts are placed just before the closing `</head>` tag to ensure they load early while not blocking the initial page render (using `defer` attribute). 5. **Analytics Function**: The first script initializes the `window.va` function which queues analytics calls before the main script loads. The second script loads the actual Vercel analytics implementation from `/_vercel/insights/script.js`. ### Next Steps: Once these changes are deployed to Vercel: 1. Analytics data will automatically start being collected 2. Visit the Vercel dashboard under the project's Analytics tab to view visitor metrics 3. No additional configuration or API keys are needed - Vercel handles this automatically ### Note on Package Manager: This project does not use npm/yarn/pnpm as it's a Jekyll static site. No package.json modifications were needed. The analytics are loaded directly from Vercel's CDN at runtime. Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Contributor
Author
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zskbot
marked this pull request as ready for review
October 26, 2026 06:19
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented Vercel Web Analytics for the OCode.js documentation site.
Changes Made
Modified Files:
Implementation Details:
Following the official Vercel Web Analytics quickstart documentation (https://vercel.com/docs/analytics/quickstart), I implemented analytics for this Jekyll-based static site using the vanilla JavaScript/HTML approach.
Added the following scripts to both HTML files just before the closing
</head>tag:Why This Approach:
Framework Detection: The project uses Jekyll (identified from
_config.ymlandvercel.json) which is a static site generator. The site is built with plain HTML files.Vanilla JS Implementation: According to Vercel's documentation, for vanilla JavaScript/HTML projects, the analytics script should be added directly to HTML files.
Files Modified: I added the script to both main HTML entry points:
index.html- The main documentation pagechatbot.html- The chatbot interface pageScript Placement: The scripts are placed just before the closing
</head>tag to ensure they load early while not blocking the initial page render (usingdeferattribute).Analytics Function: The first script initializes the
window.vafunction which queues analytics calls before the main script loads. The second script loads the actual Vercel analytics implementation from/_vercel/insights/script.js.Next Steps:
Once these changes are deployed to Vercel:
Note on Package Manager:
This project does not use npm/yarn/pnpm as it's a Jekyll static site. No package.json modifications were needed. The analytics are loaded directly from Vercel's CDN at runtime.
View Project · Web Analytics
Created by huynhthuong602687-1309 with Vercel Agent