Add guest analytics consent nudge
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-23 16:20:14 +01:00
parent 4bf0d5052c
commit bdb1789a10
7 changed files with 388 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ import type { EventBrandingPayload, FetchEventErrorCode } from './services/event
import { NotificationCenterProvider } from './context/NotificationCenterContext';
import RouteErrorElement from '@/components/RouteErrorElement';
import { isTaskModeEnabled } from './lib/engagement';
import GuestAnalyticsNudge from './components/GuestAnalyticsNudge';
const LandingPage = React.lazy(() => import('./pages/LandingPage'));
const ProfileSetupPage = React.lazy(() => import('./pages/ProfileSetupPage'));
@@ -40,6 +41,8 @@ const NotFoundPage = React.lazy(() => import('./pages/NotFoundPage'));
function HomeLayout() {
const { token } = useParams();
const location = useLocation();
const matomoEnabled = typeof window !== 'undefined' && Boolean((window as any).__MATOMO_GUEST__?.enabled);
if (!token) {
return (
@@ -49,6 +52,7 @@ function HomeLayout() {
<RouteTransition />
</div>
<BottomNav />
<GuestAnalyticsNudge enabled={matomoEnabled} pathname={location.pathname} />
</div>
);
}
@@ -56,6 +60,7 @@ function HomeLayout() {
return (
<GuestIdentityProvider eventKey={token}>
<EventBoundary token={token} />
<GuestAnalyticsNudge enabled={matomoEnabled} pathname={location.pathname} />
</GuestIdentityProvider>
);
}
@@ -158,6 +163,8 @@ function TaskGuard({ children }: { children: React.ReactNode }) {
function SetupLayout() {
const { token } = useParams<{ token: string }>();
const location = useLocation();
const matomoEnabled = typeof window !== 'undefined' && Boolean((window as any).__MATOMO_GUEST__?.enabled);
const { event } = useEventData();
if (!token) return null;
const eventLocale = event && isLocaleCode(event.default_locale) ? event.default_locale : DEFAULT_LOCALE;
@@ -177,6 +184,7 @@ function SetupLayout() {
</EventStatsProvider>
</EventBrandingProvider>
</LocaleProvider>
<GuestAnalyticsNudge enabled={matomoEnabled} pathname={location.pathname} />
</GuestIdentityProvider>
);
}
@@ -327,6 +335,8 @@ function getErrorContent(
}
function SimpleLayout({ title, children }: { title: string; children: React.ReactNode }) {
const location = useLocation();
const matomoEnabled = typeof window !== 'undefined' && Boolean((window as any).__MATOMO_GUEST__?.enabled);
return (
<EventBrandingProvider>
<div className="pb-16">
@@ -335,6 +345,7 @@ function SimpleLayout({ title, children }: { title: string; children: React.Reac
<RouteTransition>{children}</RouteTransition>
</div>
<BottomNav />
<GuestAnalyticsNudge enabled={matomoEnabled} pathname={location.pathname} />
</div>
</EventBrandingProvider>
);