From f30ab8cebe49b9ac013a368ca49d11ebe3ee9cd9 Mon Sep 17 00:00:00 2001 From: Nitish Mahipal Surana Date: Wed, 6 Aug 2025 12:29:57 -0700 Subject: [PATCH 1/3] VAP3-1024: Install HockeyStack website script --- fern/custom.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/fern/custom.js b/fern/custom.js index 70c0cb0a5..7dcc59a79 100644 --- a/fern/custom.js +++ b/fern/custom.js @@ -4,6 +4,9 @@ const WIDGET_SCRIPT_URL = isLocalhost ? 'http://localhost:9001/widget.js' : 'https://docs-widget.vercel.app/widget.js'; +// HockeyStack configuration +const HOCKEYSTACK_API_KEY = '96e358f635f3f5ea7fda26023b10da'; + function injectVapiWidget() { console.log('[custom.js] injectVapiWidget called'); if (document.querySelector(WIDGET_TAG)) { @@ -31,9 +34,33 @@ function injectVapiWidget() { console.log('[custom.js] Widget script appended to DOM'); } +function initializeHockeyStack() { + console.log('[custom.js] initializeHockeyStack called'); + + if (isLocalhost) { + console.log('[custom.js] Skipping HockeyStack on localhost'); + return; + } + + var hsscript = document.createElement("script"); + hsscript.id = "wphs"; + hsscript.src = "https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js"; + hsscript.async = 1; + hsscript.dataset.apikey = HOCKEYSTACK_API_KEY; + hsscript.dataset.cookieless = 1; + hsscript.dataset.autoIdentify = 1; + + document.getElementsByTagName('head')[0].append(hsscript); +} + +function initializeAll() { + initializeHockeyStack(); + injectVapiWidget(); +} + if (document.readyState === 'loading') { console.log('[custom.js] Waiting for DOMContentLoaded'); - document.addEventListener('DOMContentLoaded', injectVapiWidget); + document.addEventListener('DOMContentLoaded', initializeAll); } else { - injectVapiWidget(); + initializeAll(); } \ No newline at end of file From 4924ba7f20937074eb6a43ccf854ee7137d35d90 Mon Sep 17 00:00:00 2001 From: Nitish Mahipal Surana Date: Wed, 6 Aug 2025 12:33:14 -0700 Subject: [PATCH 2/3] removing debug messages --- fern/custom.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/fern/custom.js b/fern/custom.js index 7dcc59a79..163fcc0ec 100644 --- a/fern/custom.js +++ b/fern/custom.js @@ -35,8 +35,6 @@ function injectVapiWidget() { } function initializeHockeyStack() { - console.log('[custom.js] initializeHockeyStack called'); - if (isLocalhost) { console.log('[custom.js] Skipping HockeyStack on localhost'); return; @@ -59,7 +57,6 @@ function initializeAll() { } if (document.readyState === 'loading') { - console.log('[custom.js] Waiting for DOMContentLoaded'); document.addEventListener('DOMContentLoaded', initializeAll); } else { initializeAll(); From 3da7b087fb23a0496e9c88200771e2a80ce00d08 Mon Sep 17 00:00:00 2001 From: Nitish Mahipal Surana Date: Wed, 6 Aug 2025 12:35:17 -0700 Subject: [PATCH 3/3] comments --- fern/custom.js | 1 - 1 file changed, 1 deletion(-) diff --git a/fern/custom.js b/fern/custom.js index 163fcc0ec..8666b5c7f 100644 --- a/fern/custom.js +++ b/fern/custom.js @@ -4,7 +4,6 @@ const WIDGET_SCRIPT_URL = isLocalhost ? 'http://localhost:9001/widget.js' : 'https://docs-widget.vercel.app/widget.js'; -// HockeyStack configuration const HOCKEYSTACK_API_KEY = '96e358f635f3f5ea7fda26023b10da'; function injectVapiWidget() {