Add Vercel Web Analytics integration - #13
Draft
vercel[bot] wants to merge 1 commit into
Draft
Conversation
Implemented Vercel Web Analytics for Jekyll project # Summary Successfully installed and configured Vercel Web Analytics for this Jekyll static site following the latest official documentation from https://vercel.com/docs/analytics/quickstart. # Changes Made ## Modified Files: - `_includes/head.html` - Added Vercel Web Analytics tracking scripts ## Implementation Details: Since this is a Jekyll static site (not a Node.js/npm-based project), I used the vanilla JavaScript approach recommended in the Vercel documentation for static HTML sites. Added the following to `_includes/head.html` (lines 17-19): ```javascript <script> window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); }; </script> <script defer src="/_vercel/insights/script.js"></script> ``` The analytics initialization script creates the `window.va` function that queues analytics calls, and the deferred script loads the Vercel Insights tracking script from `/_vercel/insights/script.js`. # Why This Approach: 1. **Framework-Specific**: Jekyll is a Ruby-based static site generator that doesn't use npm or JavaScript frameworks like React/Next.js. The vanilla JavaScript approach is the correct method for static HTML sites. 2. **No Package Manager Required**: Since Jekyll generates static HTML, there's no need to install the `@vercel/analytics` npm package. The analytics script is loaded directly from Vercel's CDN. 3. **Placement**: The script was added to `_includes/head.html` which is included in all layout templates (index.html, page.html, post.html, etc.), ensuring analytics tracking on all pages. 4. **Non-Intrusive**: The implementation preserves all existing functionality and scripts, adding only the minimal required code for analytics tracking. # Next Steps (To Be Done in Vercel Dashboard): 1. Enable Web Analytics in the Vercel project dashboard 2. Deploy the site to activate tracking 3. Verify tracking by checking browser Network tab for requests to `/_vercel/insights/view` 4. View analytics data in the Vercel dashboard after users visit the site # Testing: - Verified the HTML syntax is correct - Confirmed the script tags were properly added to the head include file - The analytics script follows the official Vercel documentation exactly Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Author
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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 Jekyll project
Summary
Successfully installed and configured Vercel Web Analytics for this Jekyll static site following the latest official documentation from https://vercel.com/docs/analytics/quickstart.
Changes Made
Modified Files:
_includes/head.html- Added Vercel Web Analytics tracking scriptsImplementation Details:
Since this is a Jekyll static site (not a Node.js/npm-based project), I used the vanilla JavaScript approach recommended in the Vercel documentation for static HTML sites.
Added the following to
_includes/head.html(lines 17-19):The analytics initialization script creates the
window.vafunction that queues analytics calls, and the deferred script loads the Vercel Insights tracking script from/_vercel/insights/script.js.Why This Approach:
Framework-Specific: Jekyll is a Ruby-based static site generator that doesn't use npm or JavaScript frameworks like React/Next.js. The vanilla JavaScript approach is the correct method for static HTML sites.
No Package Manager Required: Since Jekyll generates static HTML, there's no need to install the
@vercel/analyticsnpm package. The analytics script is loaded directly from Vercel's CDN.Placement: The script was added to
_includes/head.htmlwhich is included in all layout templates (index.html, page.html, post.html, etc.), ensuring analytics tracking on all pages.Non-Intrusive: The implementation preserves all existing functionality and scripts, adding only the minimal required code for analytics tracking.
Next Steps (To Be Done in Vercel Dashboard):
/_vercel/insights/viewTesting:
View Project · Web Analytics
Created by opott with Vercel Agent