Skip to content

nuxt: Implement cookie banner and analytics tracking#5064

Merged
ZJvandeWeg merged 4 commits into
mainfrom
yndira/nuxt-cookie-banner
May 29, 2026
Merged

nuxt: Implement cookie banner and analytics tracking#5064
ZJvandeWeg merged 4 commits into
mainfrom
yndira/nuxt-cookie-banner

Conversation

@Yndira-E
Copy link
Copy Markdown
Contributor

@Yndira-E Yndira-E commented May 26, 2026

Description

This PR enables Nuxt-rendered pages to share the same cookie banner and analytics stack (GTM, PostHog, HubSpot) as Eleventy pages.

  • Extracts all analytics scripts (GTM, Google Consent Mode, PostHog, HubSpot tracking and chat, cookie banner) from Eleventy's base.njk into shared HTML partials at src/_includes/analytics/
  • A Nitro server plugin injects the same partials into Nuxt-rendered pages, giving a single source of truth for both frameworks during the migration period
  • Fixes LinkedIn ad cookies (_li_dcdm_c, _li_ss) persisting after consent withdrawal on production — autoClear only cleared from the current host, not from the root .flowfuse.com domain
  • Removes redundant PostHog cookie-clearing code that was already handled by autoClear in cookieconsent-config.js
  • Adds dev:nuxt script that loads the root .env consistently with other dev scripts

When the migration to Nuxt is complete, the shared HTML partials and Nitro plugin should be replaced with a native Vue plugin using vanilla-cookieconsent's official Vue integration.

The current approach was chosen to avoid duplicating the current cookie consent configuration (categories, callbacks, GTM/PostHog/HubSpot integrations) across both frameworks during the migration period. One source of truth, zero risk of the two implementations drifting apart.

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

netlify Bot commented May 26, 2026

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit bfd003a
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/6a1949d2561d300008f1ce85
😎 Deploy Preview https://deploy-preview-5064--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: 88 (🟢 up 14 from production)
Accessibility: 100 (🟢 up 2 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 Yndira-E requested a review from ZJvandeWeg May 26, 2026 17:38
@Yndira-E Yndira-E changed the title Implement cookie banner and analytics tracking for Nuxt pages nuxt: Implement cookie banner and analytics tracking May 27, 2026
@Yndira-E Yndira-E requested review from ZJvandeWeg and removed request for ZJvandeWeg May 27, 2026 18:02
@Yndira-E
Copy link
Copy Markdown
Contributor Author

Hey @ZJvandeWeg, before we merge #5065, do you think we could get this PR reviewed and merged?

It brings over the cookie banner and analytics stack (HubSpot, PostHog and GTM) from the Eleventy site, so all Nuxt pages share the same tracking and consent setup.

Comment thread package.json Outdated
@@ -0,0 +1,61 @@
<!-- Google Consent -->
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Yndira-E I don't quite understand why we wouldnt depend on the SEO package from Nuxt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The main reason for this approach is to keep a single source of truth for consent and analytics (GTM, Consent Mode, PostHog and HubSpot) while Eleventy and Nuxt coexist.

Once the migration is complete and Eleventy is no longer part of the stack, we can revisit the implementation and evaluate whether Nuxt-native solutions make more sense.

@ZJvandeWeg ZJvandeWeg merged commit 53145de into main May 29, 2026
7 checks passed
@ZJvandeWeg ZJvandeWeg deleted the yndira/nuxt-cookie-banner branch May 29, 2026 13:05
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