Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ XAI_API_KEY=xai-
NEXT_PUBLIC_POSTHOG_KEY=phc_
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

# Ahrefs Website Analytics
NEXT_PUBLIC_AHREFS_ANALYTICS_KEY=

# Notion
NOTION_API_KEY=ntn_
NOTION_DATABASE_ID=
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AhrefsAnalytics } from "@/components/ahrefs-analytics";
import { Footer } from "@/components/footer";
import { Header } from "@/components/header";
import { QueryClientWrapper } from "@/components/query-client-wrapper";
Expand Down Expand Up @@ -40,6 +41,7 @@ export default async function RootLayout({
return (
<html lang="en" className="scroll-smooth">
<GoogleAnalytics gaId="G-QFVTDBRTP4" />
<AhrefsAnalytics />
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
suppressHydrationWarning
Expand Down
17 changes: 17 additions & 0 deletions src/components/ahrefs-analytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Script from "next/script";

const AHREFS_ANALYTICS_KEY = process.env.NEXT_PUBLIC_AHREFS_ANALYTICS_KEY;

export function AhrefsAnalytics() {
if (!AHREFS_ANALYTICS_KEY) {
return null;
}

return (
<Script
src="https://analytics.ahrefs.com/analytics.js"
data-key={AHREFS_ANALYTICS_KEY}
strategy="afterInteractive"
/>
);
}
Loading