BUILT INTO EVERY GOODSPEED APP
Analytics
Screen views, custom events, and user properties are tracked via PostHog. Session recording, feature flags, and A/B test variants are available from the same SDK with no additional setup.
- Tier: Core
- Status: Config-toggled
- Config: features.analytics.posthog.enabled
WHY IT MATTERS
Most mobile app projects spend weeks plumbing the same infrastructure before writing a single line of product code. Analytics is one of those cross-cutting concerns that every app eventually needs but almost none get right the first time. Permissions are handled incorrectly, tokens expire silently, or the feature breaks after an OS update nobody tested against.
Goodspeed solves this by shipping analytics as a production-grade, tested implementation inside every generated app. The code follows the patterns in the GAS template - the same 246-feature catalog that powers every app we build. Controlled by `features.analytics.posthog.enabled` in gas.config.ts. You own the code from day one, can read every line, and can hire any React Native developer to extend it. The build pipeline verifies the feature compiles and routes resolve before the app lands in your repository, so you are not the one catching the integration error at 2 am before launch.
HOW IT IS WIRED
Real code from the GAS template
The excerpt below is lifted verbatim from lib/posthog.ts in the gas-template repository. This is the code your generated app gets, not pseudocode, not a description of intent.
// lib/posthog.ts — consent-aware PostHog initialization
export async function getPostHog(): Promise<PostHog | null> {
if (!await isAnalyticsConsentGranted()) return null;
if (_posthog) return _posthog;
const apiKey = gasConfig.backend.posthog.apiKey;
const host = gasConfig.backend.posthog.host ?? 'https://app.posthog.com';
if (!apiKey) return null;
_posthog = new PostHog(apiKey, { host });
return _posthog;
}
export async function captureEvent(
event: string,
properties?: AnalyticsProperties,
): Promise<void> {
const ph = await getPostHog();
if (!ph) return;
ph.capture(event, properties ? sanitize(properties) : undefined);
}
export async function identifyPostHogUser(
userId: string,
traits?: AnalyticsProperties,
): Promise<void> {
const ph = await getPostHog();
if (!ph) return;
ph.identify(userId, traits ? sanitize(traits) : undefined);
}Source: goodspeed-apps/gas-template → lib/posthog.ts
HONEST LIMITS
When Analytics is the wrong choice
Apps targeting highly regulated jurisdictions (e.g. HIPAA-covered healthcare) may require on-premise analytics or explicit user consent for every event. PostHog's cloud offering is not certified for PHI by default.
Tier: Core · Config-toggled
Evaluate your use case
Check whether analytics aligns with your target audience, platform constraints, and regulatory environment before enabling it.
Audit the config
The `features.analytics.posthog.enabled` flag controls this feature. Set it to false in gas.config.ts to disable the feature entirely with no residual code paths.
Seek alternatives
If the built-in implementation does not fit, the generated codebase is standard React Native + Expo code. Any library in the Expo ecosystem can replace the default.
APPS USING THIS FEATURE
Apps built with Analytics
These apps were generated by Goodspeed and use analytics as a core part of their experience. Each link goes to the full app marketing page.
CAPABILITIES
Analytics capability breakdown
Concrete dimensions of what the built-in analytics implementation covers. These reflect the actual template code, not a marketing summary.
| Item | Description | Strength |
|---|---|---|
| Event capture | captureEvent() wraps PostHog.capture() with consent checking and property sanitization. | Consent-aware |
| Identity | identifyPostHogUser() associates the Supabase user ID with the PostHog distinct ID on login. | Supabase-linked |
| Feature flags | PostHog feature flags and A/B test variants are available via the same SDK instance. | Built in |
| Initialization | The PostHog client is created lazily: only after analytics consent is granted. No calls are made before consent. | Lazy / GDPR-safe |
| Session recording | PostHog session replay is available for mobile. Disabled by default; enable via gasConfig. | Config-toggled |
GET IT BUILT INTO YOUR APP