tinyhumansai/openhuman · error
[analytics] GA initialization failed:
Error message
[analytics] GA initialization failed:
What it means
Caught failure while initializing Google Analytics in the analytics service: setting up the dataLayer/gtag shim and appending the googletagmanager script element threw (blocked network, CSP rejecting the script URL, or gtag API misuse). The catch warns; analytics stays un-initialized for the session and all GA events become no-ops.
Source
Thrown at app/src/services/analytics.ts:332
window.dataLayer = window.dataLayer || [];
window.gtag = function gtag(...args: [GtagCommand, ...unknown[]]) {
window.dataLayer.push(args);
};
window.gtag('js', new Date());
window.gtag('config', GA_MEASUREMENT_ID, {
send_page_view: false,
allow_ad_personalization_signals: false,
});
const script = document.createElement('script');
script.async = true;
script.src = `https://www.googletagmanager.com/gtag/js?id=${GA_MEASUREMENT_ID}`;
document.head.appendChild(script);
gaInitialized = true;
console.debug('[analytics] GA initialized (gtag.js)', { measurementId: GA_MEASUREMENT_ID });
} catch (err) {
console.warn('[analytics] GA initialization failed:', err);
}
}
function initOpenPanel(): void {
if (opInitialized || !OPENPANEL_CLIENT_ID || !OPENPANEL_API_URL) return;
opInitialized = true;
console.debug('[analytics] OpenPanel initialized (direct ingestion)', {
clientId: OPENPANEL_CLIENT_ID,
apiUrl: OPENPANEL_API_URL,
});
}
function initializeAnalyticsProviders(): void {
initGoogleAnalytics();
initOpenPanel();
}
/**View on GitHub (pinned to 7491200858)
Solutions
- Verify CSP allows https://www.googletagmanager.com in the webview
- Treat as soft-fail: no analytics rather than a broken UI
- Re-run initialization on consent change once network/CSP allows
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at app/src/services/analytics.ts:332 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/46fdcfb588002ff6.
Report an issue: GitHub.