Skip to content

Commit d0a500a

Browse files
authored
Add Crisp chat box to landing page (#220)
1 parent 951d835 commit d0a500a

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/pages/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@ export default function Index() {
1414
// Convert the response to text
1515
.then((response) => response.text())
1616
// Set the HTML
17-
.then((html) => setHtml(html));
17+
.then((html) => {
18+
setHtml(html);
19+
20+
// Add the crisp chat script after the dynamic html has been loaded
21+
// @ts-ignore
22+
window.$crisp = [];
23+
// @ts-ignore
24+
window.CRISP_WEBSITE_ID = 'dff22f8a-0d73-4a83-91be-1f448410c464';
25+
(function () {
26+
let d = document;
27+
let s = d.createElement('script');
28+
s.src = 'https://client.crisp.chat/l.js';
29+
s.async = true;
30+
d.getElementsByTagName('head')[0].appendChild(s);
31+
})();
32+
});
1833
}, []);
1934

2035
// Draw the arrows after any changes to the HTML

static/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@
4747
src="https://plausible.io/js/plausible.js"
4848
></script>
4949
<script defer src="./landing-page/bundle.js"></script>
50+
<script type="text/javascript">
51+
window.$crisp = [];
52+
window.CRISP_WEBSITE_ID = 'dff22f8a-0d73-4a83-91be-1f448410c464';
53+
(function () {
54+
d = document;
55+
s = d.createElement('script');
56+
s.src = 'https://client.crisp.chat/l.js';
57+
s.async = 1;
58+
d.getElementsByTagName('head')[0].appendChild(s);
59+
})();
60+
</script>
5061
</head>
5162

5263
<body>

0 commit comments

Comments
 (0)