Example proposal: cookieless analytics with native MCP integration for AI agents

Đang mở
#1,483 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
nextjs, typescript
Lĩnh vực
analytics, api, web-dev

Hướng nghiên cứu

Trước tiên, hãy đọc các ví dụ liên quan solutions/script-component-strategies và solutions/script-component-ad, cùng với framework-boilerplates/xmcp. Xác nhận xem ví dụ nên không phụ thuộc thương hiệu, có thương hiệu hay được thêm vào một solution hiện có trước khi bắt đầu. Được xem là hoàn thành khi một ví dụ đã được thống nhất minh họa tracker trong app/layout.tsx, thiết lập và các truy vấn MCP, cùng một function của Vercel cho các sự kiện tùy chỉnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Proposal

A solutions/ example showing how to integrate cookieless web analytics into a Next.js app, with native MCP so coding agents (Cursor, Claude, Codex, Windsurf) can install + query analytics in one prompt. Would slot in next to script-component-strategies and script-component-ad, which cover related <Script> patterns.

The framework already has framework-boilerplates/xmcp showing how to build an MCP server. This proposal is the complementary case: how to consume an MCP-aware analytics service from a Next.js app, end to end.

What the example would demonstrate

  1. Cookieless tracker installation — one <Script> in app/layout.tsx, gated on NEXT_PUBLIC_GIZMO_KEY. No cookie banner needed under CNIL/EDPB. afterInteractive strategy so the tracker doesn't compete with LCP.
  2. MCP server integration — the AI coding agent connects via the hosted MCP endpoint, OAuth onboarding via dynamic client registration (RFC 7591), and can run setup operations (setup_analytics_for_site, verify_install), workflow operations (summarize_all_sites, explain_traffic_change), and query primitives (filterable breakdowns, time series).
  3. Custom event tracking via Vercel functions — a small API route showing how to fire server-side events alongside the client tracker.

Why this is useful here

  • Vercel's audience increasingly uses AI coding agents — this is the only end-to-end example showing the "talk to your analytics from your editor" workflow.
  • Cookieless analytics is the de-facto choice for any EU-facing Next.js site that doesn't want a consent banner. There's no example covering that pattern today.
  • Builds naturally on script-component-strategies (script loading), which is the closest existing example.

Why I'm raising it as an issue first

I'd build this against Gizmo Analytics since that's the MCP-first analytics service I'm familiar with (free tier, MIT-licensed MCP server, hosted endpoint with full OAuth, official MCP Registry listed). But I don't want to assume a brand-specific example is what you want — wanted to check first.

Three paths I can take, ordered by preference:

  1. Brand-agnostic — solutions/cookieless-analytics-mcp using Gizmo as the concrete provider, with the README explicitly noting it's swappable for any MCP-aware analytics provider that follows the same <Script> + gizmoanalytics.io/mcp-style remote endpoint pattern.
  2. Branded — solutions/gizmo-analytics similar to how solutions/platforms-slate-supabase is brand-specific.
  3. Built into an existing example — fold the integration into one of the existing solutions/ examples (e.g., a blog template) as an opt-in analytics layer.

Happy to build whichever fits your conventions, or skip if it's not a fit. Just looking for a thumbs-up + direction before I spend the time.

Ngôn ngữ chính
TypeScript
Star
5.2k
Fork
1.9k
Merge trung bình
1 giờ 4 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vercel/examples

Tất cả issue của vercel/examples

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.