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

feat(docs): add analytics #31

Merged
merged 4 commits into from
Dec 20, 2023
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
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