Add Vercel Web Analytics integration #1
Merged
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 - Implementation Report
Overview
Successfully implemented Vercel Web Analytics across all applications in the metamask-sdk-examples repository, following framework-specific best practices.
Implementation Summary
What Was Implemented
inject()callinject()import and call in entry pointFiles Created
quickstarts/next/app/analytics.tsx- Next.js Analytics client componentquickstarts/wagmi/app/analytics.tsx- Next.js Analytics client componentpartners/dynamic/app/analytics.tsx- Next.js Analytics client componentpartners/web3auth/app/analytics.tsx- Next.js Analytics client componentFiles Modified
Next.js Applications:
quickstarts/next/app/layout.tsx- Added Analytics import and componentquickstarts/wagmi/app/layout.tsx- Added Analytics import and componentpartners/dynamic/app/layout.tsx- Added Analytics import and componentpartners/web3auth/app/layout.tsx- Added Analytics import and componentquickstarts/next/package.json- Dependency already presentquickstarts/wagmi/package.json- Dependency already presentpartners/dynamic/package.json- Dependency already presentpartners/web3auth/package.json- Dependency already presentReact/Vite Applications:
quickstarts/react/src/main.tsx- Added inject() import and callquickstarts/connectkit/src/main.tsx- Added inject() import and callquickstarts/rainbowkit/src/main.tsx- Added inject() import and callquickstarts/react/package.json- Dependency already presentquickstarts/connectkit/package.json- Dependency already presentquickstarts/rainbowkit/package.json- Dependency already presentVanilla JavaScript Application:
quickstarts/javascript/index.html- Added Vercel Analytics script tagquickstarts/javascript/package.json- Dependency already presentLock Files Updated:
Integration Details
Next.js Apps (4 apps)
analytics.tsxcomponent that uses'use client'directiveinject()from @vercel/analytics on client sideReact/Vite Apps (3 apps)
inject()at app entry point (src/main.tsx)Vanilla JavaScript App (1 app)
<script defer src="https://cdn.vercel-analytics.com/v1/script.js"></script>to HTML headImplementation Approach
inject()must run on client sideVerification Steps Completed
✅ Build verification for all 8 applications passed
✅ Linting verification passed
✅ Dependency versions verified
Notes
View Project · Web Analytics
Created by addausi with Vercel Agent