Skip to content

Commit

Permalink
feat(docs): add analytics (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
brankoconjic authored Dec 20, 2023
1 parent 1ad6a9e commit 92d4593
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.contentlayer
dist
tests/*
public/
.DS_Store
node_modules
coverage
Expand Down
15 changes: 15 additions & 0 deletions apps/docs/public/twitter-conversion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
!(function (e, t, n, s, u, a) {
e.twq ||
((s = e.twq =
function () {
s.exe ? s.exe.apply(s, arguments) : s.queue.push(arguments);
}),
(s.version = "1.1"),
(s.queue = []),
(u = t.createElement(n)),
(u.async = !0),
(u.src = "https://static.ads-twitter.com/uwt.js"),
(a = t.getElementsByTagName(n)[0]),
a.parentNode.insertBefore(u, a));
})(window, document, "script");
twq("config", "od8xu");
14 changes: 14 additions & 0 deletions apps/docs/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { Sidebar } from "@/components/Sidebar";

import "@/styles/globals.css";

import Script from "next/script";

import Fathom from "@/components/Fathom";
import Header from "@/components/Header";

Expand All @@ -28,7 +30,19 @@ export default function RootLayout({ children }: { children: React.ReactNode })
monoFont.variable
)}
>
{/* Analytics */}
<Fathom />
<Script src="/wedges/docs/twitter-conversion.js" />
<Script src="https://www.googletagmanager.com/gtag/js?id=AW-10985746469" />
<Script id="google-analytics">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-10985746469');
`}
</Script>

<div className="min-h-screen-dvh flex flex-col">
<Providers>
Expand Down
4 changes: 1 addition & 3 deletions apps/docs/src/components/Fathom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ function TrackPageView() {
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
load("VDTVBMMX", {
includedDomains: ["lemonsqueezy.com"],
});
load("VDTVBMMX");
}, []);

useEffect(() => {
Expand Down

0 comments on commit 92d4593

Please sign in to comment.