Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
feat(docs): Add Vercel analytics and Datadog 404 logging
Add @vercel/analytics for client-side page view tracking and server-side 404 logging to Datadog from the not-found page. This enables monitoring of broken links via Datadog log queries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
sohamganatra committed
Jan 28, 2026 at 16:41 UTC
60b2ccf856e1f5e7a6caf3e68609b04fcbd82c0e
4 files changed
+45
-2
docs/app/layout.tsx
+2
@@ -1,6 +1,7 @@
1
import { RootProvider } from 'fumadocs-ui/provider/next';
2
import type { Metadata } from 'next';
3
import Script from 'next/script';
4
+import { Analytics } from '@vercel/analytics/next';
5
import './global.css';
6
import { IBM_Plex_Mono } from 'next/font/google';
7
import { PostHogProvider } from '@/components/posthog-provider';
@@ -85,6 +86,7 @@ export default function Layout({ children }: LayoutProps<'/'>) {
86
/>
87
</head>
88
<body className="flex flex-col min-h-screen font-sans">
89
+ <Analytics />
90
<PostHogProvider>
91
<RootProvider
92
theme={{
docs/app/not-found.tsx
+38
-1
@@ -1,6 +1,43 @@
1
import Link from 'next/link';
2
+import { headers } from 'next/headers';
3
+
4
+async function log404ToDatadog(path: string, referer: string | null) {
5
+ const apiKey = process.env.DD_API_KEY;
6
+ if (!apiKey) return;
7
+
8
+ try {
9
+ await fetch('https://http-intake.logs.datadoghq.com/api/v2/logs', {
10
+ method: 'POST',
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ 'DD-API-KEY': apiKey,
14
+ },
15
+ body: JSON.stringify([
16
+ {
17
+ ddsource: 'composio-docs',
18
+ ddtags: 'env:production,service:docs,status:404',
19
+ hostname: 'docs.composio.dev',
20
+ message: `404 Not Found: ${path}`,
21
+ service: 'docs',
22
+ status: 'warn',
23
+ path,
24
+ referer,
25
+ },
26
+ ]),
27
+ });
28
+ } catch {
29
+ // Silently fail - don't break the 404 page
30
+ }
31
+}
32
+
33
+export default async function NotFound() {
34
+ const headersList = await headers();
35
+ const referer = headersList.get('referer');
36
+ const path = headersList.get('x-nextjs-page') || headersList.get('x-invoke-path') || 'unknown';
37
+
38
+ // Fire and forget - don't block rendering
39
+ log404ToDatadog(path, referer);
40
3
-export default function NotFound() {
41
return (
42
<div className="flex min-h-[85vh] flex-col items-center justify-center px-4">
43
<div className="relative">
docs/bun.lock
+4
-1
@@ -6,6 +6,7 @@
6
"dependencies": {
7
"@radix-ui/react-tabs": "^1.1.13",
8
"@shikijs/twoslash": "^3.21.0",
9
+ "@vercel/analytics": "^1.6.1",
10
"class-variance-authority": "^0.7.1",
11
"clsx": "^2.1.1",
12
"fumadocs-core": "^16.4.2",
@@ -50,7 +51,7 @@
51
"@types/node": "^24.10.2",
52
"@types/react": "^19.2.7",
53
"@types/react-dom": "^19.2.3",
53
- "ai": "^6.0.49",
54
+ "ai": "^6.0.30",
55
"ajv": "^8.17.1",
56
"ajv-draft-04": "^1.0.0",
57
"eslint": "^9.39.2",
@@ -731,6 +732,8 @@
732
733
"@unrs/resolver-binding-win32-x64-msvc": ["@unrs/resolver-binding-win32-x64-msvc@1.11.1", "", { "os": "win32", "cpu": "x64" }, "sha512-lrW200hZdbfRtztbygyaq/6jP6AKE8qQN2KvPcJ+x7wiD038YtnYtZ82IMNJ69GJibV7bwL3y9FgK+5w/pYt6g=="],
734
735
+ "@vercel/analytics": ["@vercel/analytics@1.6.1", "", { "peerDependencies": { "@remix-run/react": "^2", "@sveltejs/kit": "^1 || ^2", "next": ">= 13", "react": "^18 || ^19 || ^19.0.0-rc", "svelte": ">= 4", "vue": "^3", "vue-router": "^4" }, "optionalPeers": ["@remix-run/react", "@sveltejs/kit", "next", "react", "svelte", "vue", "vue-router"] }, "sha512-oH9He/bEM+6oKlv3chWuOOcp8Y6fo6/PSro8hEkgCW3pu9/OiCXiUpRUogDh3Fs3LH2sosDrx8CxeOLBEE+afg=="],
736
+
737
"@vercel/oidc": ["@vercel/oidc@3.1.0", "", {}, "sha512-Fw28YZpRnA3cAHHDlkt7xQHiJ0fcL+NRcIqsocZQUSmbzeIKRpwttJjik5ZGanXP+vlA4SbTg+AbA3bP363l+w=="],
738
739
"@volar/language-core": ["@volar/language-core@2.4.27", "", { "dependencies": { "@volar/source-map": "2.4.27" } }, "sha512-DjmjBWZ4tJKxfNC1F6HyYERNHPYS7L7OPFyCrestykNdUZMFYzI9WTyvwPcaNaHlrEUwESHYsfEw3isInncZxQ=="],
docs/package.json
+1
@@ -15,6 +15,7 @@
15
"dependencies": {
16
"@radix-ui/react-tabs": "^1.1.13",
17
"@shikijs/twoslash": "^3.21.0",
18
+ "@vercel/analytics": "^1.6.1",
19
"class-variance-authority": "^0.7.1",
20
"clsx": "^2.1.1",
21
"fumadocs-core": "^16.4.2",