-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcfd3e7
commit 0b6d962
Showing
25 changed files
with
373 additions
and
256 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
import { datadogRum, type RumInitConfiguration } from "@datadog/browser-rum"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
import { ReactNode, useEffect } from "react"; | ||
import { useFernUser } from "../atoms"; | ||
import { useSafeListenTrackEvents } from "./track"; | ||
|
||
export default function DatadogRumScript(props: RumInitConfiguration): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
useEffect(() => { | ||
datadogRum.init(props); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
|
||
const user = useFernUser(); | ||
useEffect(() => { | ||
if (user) { | ||
datadogRum.setUser({ email: user.email, name: user.name }); | ||
} else { | ||
datadogRum.clearUser(); | ||
} | ||
}, [user]); | ||
|
||
useSafeListenTrackEvents(({ event, properties }) => { | ||
datadogRum.addAction(event, properties); | ||
}); | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import * as Fathom from "fathom-client"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
import { ReactNode, useEffect } from "react"; | ||
import { useRouteChangeComplete } from "../hooks/useRouteChanged"; | ||
import { useSafeListenTrackEvents } from "./track"; | ||
|
||
export function FathomScript({ siteId }: { siteId: string }): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
useEffect(() => { | ||
Fathom.load(siteId); | ||
}, [siteId]); | ||
|
||
useRouteChangeComplete(() => { | ||
Fathom.trackPageview(); | ||
}); | ||
|
||
useSafeListenTrackEvents(({ event, properties }) => { | ||
Fathom.trackEvent(event, properties); | ||
}); | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
import Hotjar from "@hotjar/browser"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
import { ReactNode, useEffect } from "react"; | ||
import { useRouteChangeComplete } from "../hooks/useRouteChanged"; | ||
import { useSafeListenTrackEvents } from "./track"; | ||
|
||
export default function HotjarScript({ id, version }: { id: string; version: string }): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
useEffect(() => { | ||
Hotjar.init(Number(id), Number(version)); | ||
}, [id, version]); | ||
|
||
useRouteChangeComplete((route) => { | ||
Hotjar.stateChange(route); | ||
}); | ||
|
||
useSafeListenTrackEvents(({ event }) => { | ||
Hotjar.event(event); | ||
}); | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import LogRocket from "logrocket"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
import { ReactNode, useEffect } from "react"; | ||
import { useSafeListenTrackEvents } from "./track"; | ||
|
||
export default function LogRocketScript({ appId }: { appId: string }): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
useEffect(() => { | ||
LogRocket.init(appId); | ||
}, [appId]); | ||
|
||
useSafeListenTrackEvents(({ event, properties }) => { | ||
LogRocket.track(event, properties); | ||
}); | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import mixpanel from "mixpanel-browser"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
import { ReactNode, useEffect } from "react"; | ||
import { useSafeListenTrackEvents } from "./track"; | ||
|
||
export default function MixpanelScript({ token }: { token: string }): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
useEffect(() => { | ||
mixpanel.init(token, { | ||
track_pageview: true, | ||
}); | ||
}, [token]); | ||
|
||
useSafeListenTrackEvents(({ event, properties }) => { | ||
mixpanel.track(event, properties); | ||
}); | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import Script from "next/script"; | ||
import { ReactNode } from "react"; | ||
|
||
// TODO: send events to pirsch | ||
export default function PirschScript({ identificationCode }: { identificationCode: string }): ReactNode { | ||
return <Script defer src="https://api.pirsch.io/pa.js" id="pianjs" data-code={identificationCode} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import Script from "next/script"; | ||
import { ReactNode } from "react"; | ||
|
||
// TODO: send events to plausible | ||
export default function PlausibleScript({ domain }: { domain: string }): ReactNode { | ||
return <Script id="plausible" defer src="https://plausible.io/js/script.js" data-domain={domain} />; | ||
} |
Oops, something went wrong.