Set up Vercel Web Analytics integration#170
Draft
vercel[bot] wants to merge 1 commit into
Draft
Conversation
## Vercel Web Analytics Integration Successfully integrated Vercel Web Analytics into the Tabulous web application (SvelteKit project). ### Changes Made 1. **Installed `@vercel/analytics` package** (version ^1.6.1) - Updated `apps/web/package.json` with the new dependency - Updated `pnpm-lock.yaml` with the resolved dependencies 2. **Created SvelteKit analytics integration** - Added `apps/web/src/routes/+layout.ts` - Root layout file that injects analytics - Uses the `injectAnalytics` function from `@vercel/analytics/sveltekit` - Automatically detects and sets the mode based on `dev` environment variable - Mode is set to 'development' during development and 'production' in production ### Implementation Details Following the official Vercel Web Analytics guide for SvelteKit, the integration: - Calls `injectAnalytics()` in a root layout file to ensure it runs once - Automatically detects the current environment (development/production) - Provides seamless integration with SvelteKit's routing system - No route support limitations since we're using the proper SvelteKit integration ### How It Works 1. When the application loads, the `injectAnalytics` function adds the analytics tracking script 2. The script tracks page views and visitor interactions automatically 3. Data is sent to `/_vercel/insights/view` endpoint 4. Analytics data appears in the Vercel Dashboard once deployed ### Verification - Typecheck passed with no errors (svelte-check) - Production build completed successfully - All necessary files are in place - Package dependencies properly resolved ### Next Steps To complete the setup: 1. Enable Web Analytics in the Vercel dashboard for your project 2. Deploy the application to Vercel 3. View analytics data in the Vercel Dashboard's Analytics tab The implementation follows the exact pattern recommended in the Vercel Web Analytics documentation for SvelteKit projects. 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.
Vercel Web Analytics Integration
Successfully integrated Vercel Web Analytics into the Tabulous web application (SvelteKit project).
Changes Made
Installed
@vercel/analyticspackage (version ^1.6.1)apps/web/package.jsonwith the new dependencypnpm-lock.yamlwith the resolved dependenciesCreated SvelteKit analytics integration
apps/web/src/routes/+layout.ts- Root layout file that injects analyticsinjectAnalyticsfunction from@vercel/analytics/sveltekitdevenvironment variableImplementation Details
Following the official Vercel Web Analytics guide for SvelteKit, the integration:
injectAnalytics()in a root layout file to ensure it runs onceHow It Works
injectAnalyticsfunction adds the analytics tracking script/_vercel/insights/viewendpointVerification
Next Steps
To complete the setup:
The implementation follows the exact pattern recommended in the Vercel Web Analytics documentation for SvelteKit projects.
View Project · Web Analytics
Created by Damien Simonin Feugas (feugy) with Vercel Agent