UNPKG

umami-analytics-react

Version:

React hooks (useUmami, useUmamiView) and UmamiProvider for seamless Umami analytics integration, supporting page views, custom event tracking, and session identification.

10 lines (9 loc) 317 B
import { useContext } from "react"; import { UmamiProviderContext } from "../provider/context"; export const useUmami = () => { const context = useContext(UmamiProviderContext); if (context === undefined) { throw new Error("useUmami must be used within a UmamiProvider"); } return context; };