Skip to content

(WIP) hubspot-meetings: track completed bookings and identify booker in PostHog - #5867

Draft
Yndira-E wants to merge 6 commits into
mainfrom
track/hubspot-meeting-booked
Draft

Yndira-E wants to merge 6 commits into
mainfrom
track/hubspot-meeting-booked

Conversation

@Yndira-E

@Yndira-E Yndira-E commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

The embedded HubSpot calendar (/book-demo, /landing/tulip) was a black box for analytics, a cross-origin iframe with no signal for whether anyone actually got to booking. This adds a listener for the postMessage HubSpot sends on a completed booking: it fires hubspot-meeting-booked in PostHog and calls identify() with the contact's email, so we can see who booked and their full journey instead of just an anonymous count.

It also tracks hubspot-meeting-step-progressed, an approximate signal for how far someone got before booking (or dropping off), built from the embed's undocumented resize messages. It's not a precise click count, some transitions fire multiple resize events per click, others fire one, so treat it as rough progress depth, not an exact interaction tally.

Two more fixes bundled in, both surfaced while building this:

  • A pre-existing bug where, on a reload with cookies already accepted, the widget could get stuck on its consent fallback due to a race between the banner script and this component mounting.
  • The fallback panel's negative margin (meant to tuck away HubSpot's own excess iframe whitespace) was clipping its own top edge when no iframe had loaded yet.

All sales-calendar links across the site now read site.meetings.salesRoundRobin instead of each hardcoding the URL by hand.

Related Issue(s)

Checklist

  • I have read the contribution guidelines
  • I have considered the performance impact of these changes
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
  • For blog PRs, an Art Request has been created (instructions)

@netlify

netlify Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for flowfuse-website ready!

Name Link
🔨 Latest commit b2ab12b
🔍 Latest deploy log https://app.netlify.com/projects/flowfuse-website/deploys/6ab7a745a5fb250008078acd
😎 Deploy Preview https://deploy-preview-5867--flowfuse-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 46 (🟢 up 14 from production)
Accessibility: 95 (no change from production)
Best Practices: 92 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@Yndira-E
Yndira-E marked this pull request as draft September 25, 2026 16:30
@Yndira-E Yndira-E changed the title hubspot-meetings: track completed bookings and identify booker in PostHog (WIP) hubspot-meetings: track completed bookings and identify booker in PostHog Sep 25, 2026
- position now describes placement (hero / form), not the page
- identify() normalizes email and skips an already-identified session
- guards against a resent booking message counting twice
- step_count rides as a property on the outcome event instead of firing
  one event per resize message (noisy, and a false abandon on resize alone)
- hubspot-meeting-abandoned also fires on pagehide, not just SPA unmount
- message parsing extracted to nuxt/lib/hubspot-meeting-message.mjs with
  tests (fixture data anonymized)
- dataSrc stays overridable per caller, but the ?embed=true param is now
  set via URLSearchParams instead of string-concatenated
- fixes the real bug: a later mount (e.g. browser back/forward) got an
  empty calendar forever, because the already-loaded HubSpot script only
  scans for .meetings-iframe-container once. Calls
  window.hbspt.meetings.create() to re-run that scan - confirmed live
  with the exact repro (SPA nav, then back/forward)
…-booked

# Conflicts:
#	nuxt/components/HubSpotMeetings.vue
#	src/_includes/hubspot/consent-fallback.njk

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant