Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing fathom integration #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
29 changes: 14 additions & 15 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
import './globals.css'
import { Footer } from '@/components/Footer'
import { ThemeProvider } from "@/components/theme-provider"
import { Analytics } from '@vercel/analytics/react';
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { Footer } from "@/components/Footer";
import { ThemeProvider } from "@/components/theme-provider";
import Fathom from "@/lib/fathom";

const inter = Inter({ subsets: ['latin'] })
const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: 'Open Actions Directory',
description: 'Discover and Build Lens Open Actions.'
}
title: "Open Actions Directory",
description: "Discover and Build Lens Open Actions.",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode
children: React.ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning >
<html lang="en" suppressHydrationWarning>
<link
rel="shortcut icon"
href={`https://open-actions-directory.vercel.app/favicon.ico`}
Expand All @@ -31,11 +31,10 @@ export default function RootLayout({
disableTransitionOnChange
>
{children}
<Analytics />
<Fathom />
<Footer />
</ThemeProvider>
</body>
</html>
)
);
}

19 changes: 19 additions & 0 deletions lib/fathom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use client";

import { load, trackPageview } from "fathom-client";
import { useEffect } from "react";
import { usePathname, useSearchParams } from "next/navigation";

export default function Fathom() {
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
load("NEMQYNWL", {
includedDomains: ["lens.xyz", "lens.xyz/openactions"],
});

trackPageview();
}, [pathname, searchParams]);

return null;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@vercel/analytics": "^1.1.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"fathom-client": "^3.6.0",
"lucide-react": "^0.288.0",
"next": "13.5.6",
"next-themes": "^0.2.1",
Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,11 @@ fastq@^1.6.0:
dependencies:
reusify "^1.0.4"

fathom-client@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/fathom-client/-/fathom-client-3.6.0.tgz#f46d8949cf73df89998a8793e51ad2c21efd703b"
integrity sha512-/mrgmVvpw4HqDCcqUfPulERhONKgnJGL74RAxfqKDuRQ+7w9lKoTHMzqBWE7WNBvmsgZEthQWJFOWOEjv+T3gA==

file-entry-cache@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
Expand Down Expand Up @@ -3491,6 +3496,7 @@ streamsearch@^1.1.0:
integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down