diff --git a/website/index.html b/website/index.html
index 4a9b343091..42428750a8 100644
--- a/website/index.html
+++ b/website/index.html
@@ -6710,7 +6710,7 @@
contact
const meta = document.querySelector('meta[name="iii:mailmodo-form-url"]');
return meta && meta.getAttribute('content') ? meta.getAttribute('content').trim() : '';
}
- async function submitToMailmodo(email){
+ async function submitToMailmodo(email, formLocation){
const url = getMailmodoFormUrl();
if (!url) return;
try {
@@ -6722,6 +6722,7 @@ contact
// Mailmodo returns 409 for already-subscribed; treat as success.
if (!res.ok && res.status !== 409) throw new Error('mailmodo submission failed');
if (typeof window.iiiNotifyCommonRoomEmail === 'function') window.iiiNotifyCommonRoomEmail(email);
+ if (typeof window.iiiNotifyPostHogEmailSubmit === 'function') window.iiiNotifyPostHogEmailSubmit(email, formLocation);
} catch (_) {
// Swallow — we still mark the form submitted so users aren't blocked.
}
@@ -6750,7 +6751,7 @@ contact
persistAccessRequest(v);
emailForm.classList.add('submitted');
emailInput.value = '';
- submitToMailmodo(v);
+ submitToMailmodo(v, 'hero');
});
}
@@ -7104,7 +7105,7 @@ contact
persistAccessRequest(v);
form.classList.add('submitted');
input.value = '';
- submitToMailmodo(v);
+ submitToMailmodo(v, 'footer');
});
})();
diff --git a/website/posthog-consent.js b/website/posthog-consent.js
index ddc5f29848..c5c7937ab6 100644
--- a/website/posthog-consent.js
+++ b/website/posthog-consent.js
@@ -61,6 +61,36 @@
});
};
+ // Records a successful email-form submission in PostHog. We identify() the
+ // person by their email (the cross-system key Common Room also de-anonymizes
+ // on), which creates the PostHog person profile under
+ // person_profiles: 'identified_only'. Where Common Room's signals-sdk-user-id
+ // cookie is already present we attach its visitor id too, so the two systems
+ // can be joined per visitor; if it isn't set yet we just record without it.
+ function iiiReadCommonRoomId() {
+ var match = document.cookie.match(/(?:^|;\s*)signals-sdk-user-id=([^;]+)/);
+ return match ? decodeURIComponent(match[1]) : null;
+ }
+
+ window.iiiNotifyPostHogEmailSubmit = function (email, formLocation) {
+ try {
+ if (localStorage.getItem(STORAGE_KEY) !== 'accepted') return;
+ if (!window.posthog || typeof window.posthog.capture !== 'function') return;
+ var crId = iiiReadCommonRoomId();
+ var distinctId = email || crId;
+ if (distinctId) {
+ var personProps = {};
+ if (email) personProps.email = email;
+ if (crId) personProps.common_room_user_id = crId;
+ window.posthog.identify(distinctId, personProps);
+ }
+ var props = { form_location: formLocation || 'unknown' };
+ if (email) props.email = email;
+ if (crId) props.common_room_user_id = crId;
+ window.posthog.capture('website_email_submit', props);
+ } catch (_) {}
+ };
+
try {
if (localStorage.getItem(STORAGE_KEY) === 'accepted') window.iiiLoadPostHog();
} catch (_) {}