From 12747aa9c0a0028aa5497250dbfdb2aa4b2a2fd6 Mon Sep 17 00:00:00 2001 From: Deborah Niesz Date: Fri, 20 Dec 2024 12:20:06 -0300 Subject: [PATCH] Adding commonroom web tracking snippet --- docs/docusaurus/docusaurus.config.js | 4 ++++ docs/docusaurus/static/scripts/web-tracking.js | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 docs/docusaurus/static/scripts/web-tracking.js diff --git a/docs/docusaurus/docusaurus.config.js b/docs/docusaurus/docusaurus.config.js index 49e1732e1396..1d1806cd7523 100644 --- a/docs/docusaurus/docusaurus.config.js +++ b/docs/docusaurus/docusaurus.config.js @@ -34,6 +34,10 @@ module.exports = { async: true, defer: true, }, + { + src: '/scripts/web-tracking.js', + async: true + }, { src: 'https://fast.wistia.net/assets/external/E-v1.js', async: true diff --git a/docs/docusaurus/static/scripts/web-tracking.js b/docs/docusaurus/static/scripts/web-tracking.js new file mode 100644 index 000000000000..db821e8e14f6 --- /dev/null +++ b/docs/docusaurus/static/scripts/web-tracking.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/fa55f78e-0306-4363-88ae-e92ab04d95c6/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