Skip to content

Fix/hubspot meetings embed - #5906

Merged
ZJvandeWeg merged 9 commits into
mainfrom
fix/hubspot-meetings-embed
Oct 5, 2026
Merged

ZJvandeWeg merged 9 commits into
mainfrom
fix/hubspot-meetings-embed

Conversation

@Yndira-E

@Yndira-E Yndira-E commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes the embedded HubSpot calendar (/book-demo, /landing/tulip) not showing up in some cases, and keeps it behind analytics consent:

  • The component checks stored consent on mount and listens for cc:onConsent/cc:onChange, instead of the window._ffLoadMeetings global (removed from cookieconsent-config.js).
  • Each mount asks HubSpot for an iframe in its own container, so the calendar also shows after a client-side revisit, with the current page URL and UTMs.
  • The fallback stays until the iframe is in the container, so a blocked script still leaves a way to book.
  • Withdrawing consent removes the embed and swaps in a new container, so an iframe HubSpot inserts late can't load.
  • The sales calendar URL is read from site.meetings.salesRoundRobin. /landing/tulip moves to the shared calendar on purpose, and the VPP blog post links /book-demo/ instead of the retired calendar.

Known cost: HubSpot's script adds two window listeners per iframe and never removes them, so each client-side revisit adds two more and the old iframe's listener throws a TypeError in HubSpot's code. The calendar is unaffected.

Supersedes #5910.

Follow-ups

  • Evaluate rendering the iframe directly to drop the listener leak.

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 Oct 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for flowfuse-website ready!

Name Link
🔨 Latest commit 3b6781e
🔍 Latest deploy log https://app.netlify.com/projects/flowfuse-website/deploys/6ac3c10a17611f0008a1c38a
😎 Deploy Preview https://deploy-preview-5906--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: 42 (🟢 up 10 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 requested review from ZJvandeWeg and dimitrieh and removed request for dimitrieh October 5, 2026 10:37
@Yndira-E
Yndira-E marked this pull request as ready for review October 5, 2026 10:37

@dimitrieh dimitrieh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yndira, approving this one. Checking the stored consent on mount fixes the calendar not showing after a reload.

I opened a follow-up for you to consider: #5910. It creates a new iframe on each mount rather than re-attaching the earlier one, keeps the fallback up until the iframe is actually there, and removes the embed when analytics consent is withdrawn. The trade-off is the one you avoided here: HubSpot's leftover listeners throw a console error after a client-side revisit, though the calendar itself works. If you agree with the approach, merge it after this one.

dimitrieh and others added 3 commits October 5, 2026 16:21
Builds on the consent check from the previous commits and replaces the
retained-iframe approach:

- Each mount calls hbspt.meetings.create() for its own container (unique id
  from useId), so a page reached by client-side navigation gets a fresh,
  correctly addressed iframe without rewriting HubSpot's src by hand. This
  also keeps the current HubSpot utk, and lets two instances coexist.
- The fallback stays until an iframe is actually in the container, watched
  with a MutationObserver. HubSpot inserts it after create() returns, so
  setting embedded on script load emptied the slot early, and a blocked or
  stubbed script left neither calendar nor fallback.
- The script 'load' listener is removed on unmount, so a stale instance can
  no longer call create() on another page.
- Withdrawing analytics consent removes the embed.
- The VPP blog post linked the retired round-robin calendar through a mangled
  URL; it now links /book-demo/.

Known cost: HubSpot's script adds two window message listeners per iframe and
never removes them. After a client-side revisit, the old iframe's consent
listener throws "Cannot read properties of null (reading 'postMessage')" in
HubSpot's own code when the new iframe loads. The calendar is unaffected.
@Yndira-E

Yndira-E commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @dimitrieh! I've implemented your suggestion, plus a couple of things on top. Could you take another look and merge if it's all OK?

@ZJvandeWeg
ZJvandeWeg merged commit 3f343b3 into main Oct 5, 2026
8 checks passed
@ZJvandeWeg
ZJvandeWeg deleted the fix/hubspot-meetings-embed branch October 5, 2026 15:36
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.

3 participants