-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as amplitude from "@amplitude/analytics-browser"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
|
||
export default function AmplitudeScript({ apiKey }: { apiKey: string }): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
try { | ||
amplitude.init(apiKey, undefined, { | ||
autocapture: true, | ||
}); | ||
} catch (e) { | ||
// eslint-disable-next-line no-console | ||
console.error("Error initializing Amplitude", e); | ||
} | ||
}, [apiKey]); | ||
|
||
return false; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Script from "next/script"; | ||
import { ReactNode } from "react"; | ||
|
||
export default function ClearbitScript({ apiKey }: { apiKey: string }): ReactNode { | ||
return ( | ||
<Script | ||
id="clearbit" | ||
src={`https://tag.clearbitscripts.com/v1/${apiKey}/tags.js`} | ||
referrerPolicy="strict-origin-when-cross-origin" | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { datadogRum, type RumInitConfiguration } from "@datadog/browser-rum"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
|
||
export default function DatadogRumScript(props: RumInitConfiguration): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
datadogRum.init(props); | ||
}, []); | ||
|
||
return false; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as Fathom from "fathom-client"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
import { useRouteChangeComplete } from "../hooks/useRouteChanged"; | ||
|
||
export function FathomScript({ siteId }: { siteId: string }): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
Fathom.load(siteId); | ||
}, [siteId]); | ||
|
||
useRouteChangeComplete(() => { | ||
Fathom.trackPageview(); | ||
}); | ||
|
||
return false; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Script from "next/script"; | ||
import { ReactNode } from "react"; | ||
|
||
export default function HeapScript({ appId }: { appId: string }): ReactNode { | ||
return <Script id="heap" type="text/javascript" dangerouslySetInnerHTML={{ __html: initHeapScript(appId) }} />; | ||
} | ||
|
||
function initHeapScript(appId: string) { | ||
return ` | ||
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-"+e+".js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a);for(var n=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],o=0;o<p.length;o++)heap[p[o]]=n(p[o])}; | ||
heap.load("${appId}"); | ||
`; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Hotjar from "@hotjar/browser"; | ||
import { ReactNode } from "react"; | ||
import { useIsomorphicLayoutEffect } from "swr/_internal"; | ||
import { useRouteChangeComplete } from "../hooks/useRouteChanged"; | ||
|
||
export default function HotjarScript({ id, version }: { id: string; version: string }): ReactNode { | ||
useIsomorphicLayoutEffect(() => { | ||
Hotjar.init(Number(id), Number(version)); | ||
}, [id, version]); | ||
|
||
useRouteChangeComplete((route) => { | ||
Hotjar.stateChange(route); | ||
}); | ||
|
||
return false; | ||
} |