Skip to content

Refactor HubSpot forms: implementation of resilient loading pattern and GDPR-compliant fallbacks#4625

Merged
knolleary merged 9 commits intomainfrom
yndira/gate-hubspot-forms
Mar 4, 2026
Merged

Refactor HubSpot forms: implementation of resilient loading pattern and GDPR-compliant fallbacks#4625
knolleary merged 9 commits intomainfrom
yndira/gate-hubspot-forms

Conversation

@Yndira-E
Copy link
Contributor

@Yndira-E Yndira-E commented Mar 3, 2026

Description

This PR refactors the HubSpot form integration to use a centralized, robust loading pattern. It moves from scattered inline scripts to a global helper (ffCreateHubSpotForm) that manages the form lifecycle, prevents duplicate injections, and handles failure states gracefully.

What changed

Shared HubSpot helper in base JS

  • Added loadHubSpotFormsScript() and ffCreateHubSpotForm(config) in src/_includes/base.js.
  • Ensures:
    • HubSpot forms script loads once,
    • form creation is idempotent,
    • fallback is shown/hidden correctly.

Unified fallback component

  • Added reusable partial: src/_includes/hubspot/consent-fallback.njk.
  • Updated:
    • hs-form.njk
    • hs-book-meeting.njk
  • Result: same fallback UX for blocked forms/calendars.

Template cleanup and reuse

  • Removed duplicate newsletter partial:
    • deleted src/_includes/hubspot/hs-newsletter.njk
  • Updated blog includes to use hs-form.njk with explicit form params:
    • src/_includes/blog/blog-posts.njk
  • Updated migration page to use shared HubSpot form include:
    • src/_includes/migration.njk
  • Updated src/blog/2025/07/certified-nodes-v2.md:
    • switched to Nunjucks rendering in markdown (templateEngineOverride: njk,md)
    • replaced inline HubSpot embed with shared include
    • separated article form configuration to avoid collisions with sidebar signup form.

Cookie consent copy updates

  • Updated consent text in src/js/cookieconsent-config.js

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
Copy link

netlify bot commented Mar 3, 2026

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit 9bcd766
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/69a70868b0f9960008edab75
😎 Deploy Preview https://deploy-preview-4625--flowforge-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: 94 (🟢 up 4 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 91 (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.

@netlify
Copy link

netlify bot commented Mar 3, 2026

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit 873f8a6
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/69a7f7f3df2f570008e7c62c
😎 Deploy Preview https://deploy-preview-4625--flowforge-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: 91 (🔴 down 1 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 91 (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
Copy link
Contributor Author

Yndira-E commented Mar 3, 2026

cc @UnicornGunnerz @PabloFilomeno83 and @sumitshinde-84 for visibility

@Yndira-E Yndira-E marked this pull request as draft March 3, 2026 19:32
@Yndira-E
Copy link
Contributor Author

Yndira-E commented Mar 3, 2026

Converting to draft, need to do some tweaks

@Yndira-E
Copy link
Contributor Author

Yndira-E commented Mar 4, 2026

I've updated the PR description and implementation because I've shifted the strategy based on GDPR best practices.

Why I changed my mind about 'Gating' forms:
Originally, I considered blocking the forms entirely until cookies were accepted. However, after further research:

  • GDPR Compliance: Forcing a user to accept analytics cookies just to use a 'Support' or 'Contact' form is legally problematic (consent must be 'freely given' and not a condition for a service).
  • Technical Necessity: We can treat the form's basic functionality and reCAPTCHA as 'Strictly Necessary' for security/service delivery, provided we keep tracking disabled.
  • Conversion: Gating forms creates a huge friction point.

The current approach:
Instead of gating, I've focused this PR on making the form delivery resilient. The form loads by default with doNotTrack, and we provide a much better 'Fallback' experience (including a link to our /contact-us/ page for HS calendars) if the script is blocked by external privacy tools. This gives us the best balance between legal safety and user experience.

@Yndira-E Yndira-E marked this pull request as ready for review March 4, 2026 09:25
@Yndira-E Yndira-E changed the title Gate HubSpot forms behind Analytics consent and unify HubSpot fallback handling Refactor HubSpot forms: implementation of resilient loading pattern and GDPR-compliant fallbacks Mar 4, 2026
@knolleary knolleary merged commit c8f7d1c into main Mar 4, 2026
7 checks passed
@knolleary knolleary deleted the yndira/gate-hubspot-forms branch March 4, 2026 10:28
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.

2 participants