Skip to content

Commit 0b1d542

Browse files
authored
Add CommonRoom script (#220)
Same as svix/www#373
1 parent 7e807d6 commit 0b1d542

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

docusaurus.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ module.exports = {
121121
src: "/js/segment.js",
122122
async: true,
123123
defer: true,
124+
},
125+
{
126+
src: "/js/commonroom.js",
127+
async: true,
128+
defer: true,
124129
}
125130
],
126131
markdown: {

static/js/commonroom.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(function () {
2+
if (typeof window === 'undefined') return;
3+
if (typeof window.signals !== 'undefined') return;
4+
var script = document.createElement('script');
5+
script.src = 'https://cdn.cr-relay.com/v1/site/b184a8a2-6ac1-4606-b0cb-a52a8b86395b/signals.js';
6+
script.async = true;
7+
window.signals = Object.assign(
8+
[],
9+
['page', 'identify', 'form'].reduce(function (acc, method) {
10+
acc[method] = function () {
11+
signals.push([method, arguments]);
12+
return signals;
13+
};
14+
return acc;
15+
}, {})
16+
);
17+
document.head.appendChild(script);
18+
})();

0 commit comments

Comments
 (0)