Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
put hotjar in client using loader method
Browse files Browse the repository at this point in the history
  • Loading branch information
bthaile committed Feb 16, 2023
1 parent 1e53e00 commit ecee1c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 0 additions & 6 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ import * as Sentry from "@sentry/node"
import "@sentry/tracing"
import { renderToString } from "react-dom/server"
import { getRequiredGlobalEnvVar } from "./cms/helpers"
import Hotjar from "@hotjar/browser"

Sentry.init({
...(process.env.SENTRY_DSN && { dsn: process.env.SENTRY_DSN }),
tracesSampleRate: 0.3,
environment: getRequiredGlobalEnvVar("SENTRY_ENV", "development"),
})

if (process.env.NODE_ENV === "production") {
const hotjarVersion = 6
Hotjar.init(parseInt(process.env.HOTJAR_SITE_ID ?? ""), hotjarVersion)
}

export default function handleRequest(
request: Request,
responseStatusCode: number,
Expand Down
5 changes: 5 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ export const loader = async ({ request }: LoaderArgs) => {
})
}

if (process.env.NODE_ENV === "production") {
const hotjarVersion = 6
Hotjar.init(parseInt(process.env.HOTJAR_SITE_ID ?? ""), hotjarVersion)
}

let algolia: SearchProps | undefined = undefined

if (process.env.ALGOLIA_APP_ID) {
Expand Down

0 comments on commit ecee1c8

Please sign in to comment.