From f8e6d1caaab30b66d971c27821528803203019c8 Mon Sep 17 00:00:00 2001 From: Pasha Sviderski Date: Thu, 9 Jul 2026 14:58:47 +1000 Subject: [PATCH] website: send Hub early access form submission to posthog --- website/Caddyfile | 14 ++++++ website/landing/hub.html | 81 ++++++++++++++++++++++++++++++++--- website/landing/index.html | 3 +- website/landing/js/posthog.js | 15 +++++++ website/landing/style.css | 36 ++++++++++++++-- 5 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 website/landing/js/posthog.js diff --git a/website/Caddyfile b/website/Caddyfile index 51fa3e5c..b8e05f69 100644 --- a/website/Caddyfile +++ b/website/Caddyfile @@ -3,6 +3,20 @@ } :8000 { + # Reverse proxy PostHog through our own domain so ad blockers don't drop analytics requests. + # Static assets (e.g. array.js) are served from a separate PostHog assets host. + handle_path /phproxy/static/* { + rewrite * /static{uri} + reverse_proxy https://us-assets.i.posthog.com { + header_up Host us-assets.i.posthog.com + } + } + handle_path /phproxy/* { + reverse_proxy https://us.i.posthog.com { + header_up Host us.i.posthog.com + } + } + root * /usr/share/caddy file_server log diff --git a/website/landing/hub.html b/website/landing/hub.html index 5e5ef591..a0e789fa 100644 --- a/website/landing/hub.html +++ b/website/landing/hub.html @@ -32,6 +32,8 @@ content="Uncloud Hub will add a dashboard, metrics, logs, and alerts to the Uncloud clusters you already run. Skip the weekend of wiring Prometheus, Loki, and Grafana. Join the early access list."> + + @@ -205,8 +207,7 @@ class="group block relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden">

390+

-

Discord - members

+

Fans on Discord

@@ -819,7 +820,7 @@

-
+
@@ -836,12 +837,39 @@ placeholder="e.g. searchable logs across all my services, or alerts when something goes down..." class="form-textarea w-full bg-white border-zinc-700 rounded-lg px-4 py-3 text-sm text-zinc-900 resize-none">
-
+ + + + + +

Uncloud updates only, no spam. Or email posthogDeadline) { + formError.classList.remove('hidden'); + } + setTimeout(enableFormWhenPostHogLoads, 200); + })(); + + form.addEventListener('submit', function (e) { + e.preventDefault(); + const email = form.elements.email.value.trim(); + if (!email) return; + try { + // Key the person by email so the early access list shows up under People in PostHog. + posthog.identify(email, {email: email}); + posthog.capture('hub_early_access_requested', { + email: email, + message: form.elements.message.value.trim(), + }); + } catch (err) { + console.error('Failed to send the form:', err); + formError.classList.remove('hidden'); + return; + } + form.classList.add('hidden'); + formSuccess.classList.remove('hidden'); + }); })(); diff --git a/website/landing/index.html b/website/landing/index.html index 615b9e04..3e8b4280 100644 --- a/website/landing/index.html +++ b/website/landing/index.html @@ -32,9 +32,8 @@ content="Take your Docker Compose apps to production with zero-downtime deployments, automatic HTTPS, and cross-machine scaling. Self-hosting made reliable without the complexity."> - + diff --git a/website/landing/js/posthog.js b/website/landing/js/posthog.js new file mode 100644 index 00000000..8fc7b0c3 --- /dev/null +++ b/website/landing/js/posthog.js @@ -0,0 +1,15 @@ +// PostHog analytics and form processing for the landing pages. +// The project API key is public and safe to expose in client-side code. +const POSTHOG_API_KEY = 'phc_nsuhPtAsiYAFiSYmc2KwA5Homz6miXWjf3Hy4J4H3QMV'; + +(function () { + // Official PostHog JS snippet from Project settings - General - HTML snippet. + !function(t,e){var o,n,p,r;e.__SV||(window.posthog && window.posthog.__loaded)||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="ki Ci init qi Hi pr Bi zi Di capture calculateEventProperties Qi register register_once register_for_session unregister unregister_for_session Ki getFeatureFlag getFeatureFlagPayload getFeatureFlagResult getAllFeatureFlags isFeatureEnabled reloadFeatureFlags updateFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSurveysLoaded onSessionId getSurveys getActiveMatchingSurveys renderSurvey displaySurvey cancelPendingSurvey canRenderSurvey canRenderSurveyAsync Xi identify setPersonProperties unsetPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset shutdown setIdentity clearIdentity get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException addExceptionStep captureLog startExceptionAutocapture stopExceptionAutocapture loadToolbar get_property getSessionProperty Ji Gi createPersonProfile setInternalOrTestUser Yi Ai rn opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing get_explicit_consent_status is_capturing clear_opt_in_out_capturing Vi debug mr it getPageViewId captureTraceFeedback captureTraceMetric Oi".split(" "),n=0;n