useAnalytics

Analytics hook

Examples

Basic Usage

This hook injects analytic scripts into the header

// import { useAnalytics } from '@octanner/prism-core/hooks';
// import LayoutContext from '@octanner/prism-core/context/Layout'
() => {
const [currentIdentityQuery, layoutQuery] = React.useContext(LayoutContext);
const bank =
layoutQuery?.data?.bankBalance?.find((bank) => bank.defaultBank) ||
layoutQuery?.data?.bankBalance?.[0];
const links = useLayoutLinks(layoutQuery?.data);
useAnalytics({
currentIdentity: currentIdentityQuery?.data?.currentIdentity,
fullStoryOrg: "fullstory-org-id",
links,
bank,
});
return null;
};