Highlight identifies users

This commit is contained in:
Matt Aitken
2023-07-06 20:45:00 +01:00
parent 28c5acc6af
commit 7341b4cf61
2 changed files with 16 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { H } from "highlight.run";
import { useUserChanged } from "./useUser";
export function useHighlight() {
useUserChanged((user) => {
if (!user) {
return;
}
H.identify(user.id, {
email: user.email,
});
});
}
+2
View File
@@ -29,6 +29,7 @@ import { usePostHog } from "./hooks/usePostHog";
import { getUser } from "./services/session.server";
import { appEnvTitleTag } from "./utils";
import { ErrorBoundary as HighlightErrorBoundary } from "@highlight-run/react";
import { useHighlight } from "./hooks/useHighlight";
export const links: LinksFunction = () => {
return [{ rel: "stylesheet", href: tailwindStylesheetUrl }];
@@ -96,6 +97,7 @@ function App() {
const { posthogProjectKey, highlightProjectId } =
useTypedLoaderData<typeof loader>();
usePostHog(posthogProjectKey);
useHighlight();
return (
<>