Skip to content

Commit a6be1f7

Browse files
authored
Merge pull request #49 from steel-dev/add-reo-analytics
feat: add Reo.dev analytics pixel
2 parents 3569933 + b78cfae commit a6be1f7

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

.env-example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NEXT_PUBLIC_GTM_ID=
2+
NEXT_PUBLIC_REO_CLIENT_ID= # Reo.dev analytics client ID; set only in production so forks/previews don't pollute analytics
23
LLMS_BASE_URL=
34
GITHUB_APP_ID=
45
GITHUB_APP_PRIVATE_KEY= # Base64 encoded GitHub App private key

app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { RootProvider } from 'fumadocs-ui/provider';
33
import { GeistMono } from 'geist/font/mono';
44
import type { Metadata } from 'next';
55
import type { ReactNode } from 'react';
6+
import { ReoAnalytics } from '@/components/analytics/reo';
67
import { inter, jetBrainsMono } from '@/fonts';
78
import { KeyboardShortcutsProvider } from '@/hooks/use-keyboard-shortcuts';
89
import { QueryProvider } from '@/providers/query-provider';
@@ -52,6 +53,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
5253
>
5354
<head />
5455
<body className="flex flex-col min-h-screen">
56+
<ReoAnalytics />
5557
<QueryProvider>
5658
<KeyboardShortcutsProvider>
5759
<RootProvider

components/analytics/reo.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use client';
2+
3+
import Script from 'next/script';
4+
5+
export function ReoAnalytics() {
6+
const clientID = process.env.NEXT_PUBLIC_REO_CLIENT_ID;
7+
8+
if (!clientID) {
9+
return null;
10+
}
11+
12+
return (
13+
<Script id="reo-init" strategy="afterInteractive">
14+
{`!function(){var e,t,n;e="${clientID}",t=function(){Reo.init({clientID:"${clientID}", enableThirdPartyTracking:true})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.defer=!0,n.onload=t,document.head.appendChild(n)}();`}
15+
</Script>
16+
);
17+
}

0 commit comments

Comments
 (0)