Skip to content

Commit b9ccedf

Browse files
committed
Add fathom snippet
1 parent 844fa93 commit b9ccedf

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

frontend/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1111
<!--render-helmet--><title>Hi.Events</title><!--/render-helmet-->
1212
<!--environment-variables-->
13+
<!--head-snippets-->
1314
</head>
1415
<body >
1516
<div id="app"><!--app-html--></div>

frontend/server.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ app.use("*", async (req, res) => {
8787

8888
const envVariablesHtml = `<script>window.hievents = ${getViteEnvironmentVariables()};</script>`;
8989

90+
const headSnippets = [];
91+
if (process.env.VITE_FATHOM_SITE_ID) {
92+
headSnippets.push(`
93+
<script src="https://cdn.usefathom.com/script.js" data-spa="auto" data-site="${process.env.VITE_FATHOM_SITE_ID}" defer></script>
94+
`);
95+
}
96+
9097
const html = template
98+
.replace("<!--head-snippets-->", headSnippets.join("\n"))
9199
.replace("<!--app-html-->", appHtml)
92100
.replace("<!--dehydrated-state-->", `<script>window.__REHYDRATED_STATE__ = ${stringifiedState}</script>`)
93101
.replace("<!--environment-variables-->", envVariablesHtml)

frontend/src/components/common/WidgetEditor/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ export default App;
253253
<div style={{marginTop: 15, marginBottom: 15}}>
254254
<Tabs.Panel value="html">
255255
<Textarea
256+
onChange={void 0}
256257
description={t`Place this in the <head> of your website.`}
257258
label={(
258259
<Group>
@@ -264,6 +265,7 @@ export default App;
264265
value={embedScript}
265266
/>
266267
<Textarea
268+
onChange={void 0}
267269
description={t`Paste this where you want the widget to appear.`}
268270
label={(
269271
<Group>
@@ -358,4 +360,4 @@ export default App;
358360
</div>
359361
</div>
360362
);
361-
};
363+
};

0 commit comments

Comments
 (0)