diff --git a/docusaurus.config.js b/docusaurus.config.js index 7402cf660b..f7bb31d329 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -62,6 +62,11 @@ const config = { '/js/visitoranalytics.js', async: true, }, + { + src: + '/js/commonroom.js', + async: true, + }, ], themeConfig: diff --git a/static/js/commonroom.js b/static/js/commonroom.js new file mode 100644 index 0000000000..6410a49999 --- /dev/null +++ b/static/js/commonroom.js @@ -0,0 +1,18 @@ +(function() { + if (typeof window === 'undefined') return; + if (typeof window.signals !== 'undefined') return; + var script = document.createElement('script'); + script.src = 'https://cdn.cr-relay.com/v1/site/ecfd6f4a-ae37-43b1-b11b-2a92f09f3089/signals.js'; + script.async = true; + window.signals = Object.assign( + [], + ['page', 'identify', 'form'].reduce(function (acc, method){ + acc[method] = function () { + signals.push([method, arguments]); + return signals; + }; + return acc; + }, {}) + ); + document.head.appendChild(script); + })(); \ No newline at end of file