From 1a0d6270af38bcf6fcf7c312dd4d5c5c8fc1aa2d Mon Sep 17 00:00:00 2001 From: Roo Code Date: Thu, 22 Jan 2026 02:02:55 +0000 Subject: [PATCH] feat: add HubSpot tracking with consent-based loading --- .../src/app/legal/cookies/page.tsx | 30 +++++++++-- .../components/providers/hubspot-provider.tsx | 50 +++++++++++++++++++ .../src/components/providers/providers.tsx | 13 +++-- 3 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 apps/web-roo-code/src/components/providers/hubspot-provider.tsx diff --git a/apps/web-roo-code/src/app/legal/cookies/page.tsx b/apps/web-roo-code/src/app/legal/cookies/page.tsx index c8058a34e77..895d7c2b456 100644 --- a/apps/web-roo-code/src/app/legal/cookies/page.tsx +++ b/apps/web-roo-code/src/app/legal/cookies/page.tsx @@ -100,6 +100,19 @@ export default function CookiePolicy() { 1 year ph_* + + HubSpot + + Marketing automation and visitor tracking + + + Analytics (only with your consent) + + 13 months + + hubspotutk, __hstc, __hssrc, __hssc + + @@ -122,6 +135,15 @@ export default function CookiePolicy() { PostHog Privacy Policy

+

+ + HubSpot Privacy Policy + +

Essential cookies

@@ -133,10 +155,10 @@ export default function CookiePolicy() {

Analytics cookies

- We use PostHog analytics cookies to understand how visitors interact with our website. This - helps us improve our services and user experience. Analytics cookies are placed only if you give - consent through our cookie banner. The lawful basis for processing these cookies is your - consent, which you can withdraw at any time. + We use PostHog and HubSpot analytics cookies to understand how visitors interact with our + website. This helps us improve our services, user experience, and marketing efforts. Analytics + cookies are placed only if you give consent through our cookie banner. The lawful basis for + processing these cookies is your consent, which you can withdraw at any time.

Third-party services

diff --git a/apps/web-roo-code/src/components/providers/hubspot-provider.tsx b/apps/web-roo-code/src/components/providers/hubspot-provider.tsx new file mode 100644 index 00000000000..9f0236d62b6 --- /dev/null +++ b/apps/web-roo-code/src/components/providers/hubspot-provider.tsx @@ -0,0 +1,50 @@ +"use client" + +import { useEffect, useState } from "react" +import Script from "next/script" +import { hasConsent, onConsentChange } from "@/lib/analytics/consent-manager" + +// HubSpot Account ID +const HUBSPOT_ID = "243714031" + +/** + * HubSpot Tracking Provider + * Loads HubSpot tracking script only after user consent is given, following GDPR requirements + */ +export function HubSpotProvider({ children }: { children: React.ReactNode }) { + const [shouldLoad, setShouldLoad] = useState(false) + + useEffect(() => { + // Check initial consent status + if (hasConsent()) { + setShouldLoad(true) + } + + // Listen for consent changes + const unsubscribe = onConsentChange((consented) => { + if (consented) { + setShouldLoad(true) + } + }) + + return unsubscribe + }, []) + + return ( + <> + {shouldLoad && ( + <> + {/* HubSpot Embed Code */} +