This repository has been archived on 2024-07-16. You can view files and clone it, but cannot push or open issues or pull requests.
www.local-ip.sh/app/hooks/use-fathom.ts

19 lines
401 B
TypeScript
Raw Normal View History

2023-12-13 20:48:50 +00:00
import { useEffect } from "react";
import { useLocation } from "@remix-run/react";
import * as Fathom from "fathom-client";
export default function useFathom() {
2023-12-22 22:59:14 +00:00
const location = useLocation();
2023-12-13 20:48:50 +00:00
2023-12-22 22:59:14 +00:00
useEffect(() => {
Fathom.load(window.siteConfig.fathom.siteId, {
spa: "history",
includedDomains: ["local-ip.sh"],
});
}, []);
2023-12-13 20:48:50 +00:00
2023-12-22 22:59:14 +00:00
useEffect(() => {
Fathom.trackPageview();
}, [location]);
2023-12-13 20:48:50 +00:00
}