Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): inject OpenPanel script via root layout

Richie McIlroy0bc25ab66ab0
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index f2c9726cc..d6602ef70 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -1,4 +1,6 @@
import "@/app/globals.css";
+import { buildEnv } from "@cap/env";
+import { OpenPanelComponent } from "@openpanel/nextjs";
import type { Metadata } from "next";
import localFont from "next/font/local";
import Script from "next/script";
@@ -99,6 +101,15 @@ export default function RootLayout({ children }: PropsWithChildren) {
</head>
<body suppressHydrationWarning>
<Script src="/theme-script.js" strategy="beforeInteractive" />
+ {buildEnv.NEXT_PUBLIC_OPENPANEL_CLIENT_ID ? (
+ <OpenPanelComponent
+ apiUrl="/api/op"
+ clientId={buildEnv.NEXT_PUBLIC_OPENPANEL_CLIENT_ID}
+ scriptUrl="/api/op/op1.js"
+ trackOutgoingLinks
+ trackScreenViews
+ />
+ ) : null}
<main className="w-full">{children}</main>
</body>
</html>