@bentonow/bento-nextjs-sdk
Version:
🍱 Bento Next.JS SDK and tracking library
20 lines • 512 B
JavaScript
import { usePathname } from "next/navigation";
import { useEffect } from "react";
function useBentoAnalytics(userEmail) {
const pathname = usePathname();
useEffect(() => {
const trackPageView = () => {
if (window.bento !== void 0) {
if (userEmail) {
window.bento.identify(userEmail);
}
window.bento.view();
}
};
setTimeout(trackPageView, 0);
}, [pathname, userEmail]);
}
export {
useBentoAnalytics
};
//# sourceMappingURL=useBentoAnalytics.js.map