Skip to content

Commit 68c997b

Browse files
committed
refactor(shell-docs): align analytics surface with upstream LCP trim
Mirrors upstream CopilotKit#4646 in two changes from the same PR: - Drop the duplicate useRB2B hook in favor of the canonical <Script id="reb2b-script"> in app/layout.tsx (gated on REB2B_KEY). Env var renames from NEXT_PUBLIC_RB2B_ID (the hook's name) to NEXT_PUBLIC_REB2B_KEY (upstream's canonical name) — deployment ops will need updating. - Set capture_dead_clicks: false on PostHog init so the dead-clicks-autocapture.js bundle isn't pulled in on the critical path.
1 parent e1b3e36 commit 68c997b

4 files changed

Lines changed: 10 additions & 48 deletions

File tree

showcase/shell-docs/src/app/layout.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export default function RootLayout({
8383
: rawSha.slice(0, 7);
8484

8585
const REO_KEY = process.env.NEXT_PUBLIC_REO_KEY;
86+
const REB2B_KEY = process.env.NEXT_PUBLIC_REB2B_KEY;
8687

8788
return (
8889
<html
@@ -119,6 +120,13 @@ export default function RootLayout({
119120
async
120121
defer
121122
/>
123+
{REB2B_KEY ? (
124+
<Script
125+
id="reb2b-script"
126+
strategy="afterInteractive"
127+
src={`https://b2bjsstore.s3.us-west-2.amazonaws.com/b/${REB2B_KEY}/${REB2B_KEY}.js.gz`}
128+
/>
129+
) : null}
122130
</head>
123131
<body className="min-h-screen">
124132
<AnalyticsClient />

showcase/shell-docs/src/components/analytics-client.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use client";
22

33
import { useGoogleAnalytics } from "@/lib/hooks/use-google-analytics";
4-
import { useRB2B } from "@/lib/hooks/use-rb2b";
54
import { CopyTracker } from "@/lib/providers/copy-tracker";
65

76
/**
@@ -12,7 +11,6 @@ import { CopyTracker } from "@/lib/providers/copy-tracker";
1211
* pattern: one client boundary, all hooks together.
1312
*/
1413
export function AnalyticsClient() {
15-
useRB2B();
1614
useGoogleAnalytics();
1715
return <CopyTracker />;
1816
}

showcase/shell-docs/src/lib/hooks/use-rb2b.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.

showcase/shell-docs/src/lib/providers/posthog-provider.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) {
115115
: undefined,
116116
// Disable automatic pageview capture (we do it manually)
117117
capture_pageview: false,
118+
// Skip dead-clicks-autocapture.js to trim LCP analytics surface
119+
capture_dead_clicks: false,
118120
// Reduce network requests by batching
119121
request_batching: true,
120122
// Don't enable debug mode - it causes too much logging

0 commit comments

Comments
 (0)