ionic-analytics
Installation
SKILL.md
Analytics
Two viable choices for product analytics on Ionic Capacitor — pick one. Don't run both.
| Firebase Analytics | PostHog | |
|---|---|---|
| Pricing | Free | Free up to 1M events/mo |
| Funnels / cohorts | Yes (Looker / BigQuery integration) | Yes (built-in) |
| A/B testing | Via Firebase Remote Config | Built-in feature flags |
| Session replay | No (use Sentry / Hotjar) | Yes |
| Self-host | No | Yes |
| Mobile SDK | Native via @capacitor-firebase/analytics |
JS SDK works in WebView; native plugin available |
| Best for | Already-on-Firebase teams; simple needs | Product-led teams; flag-driven experimentation |
When to consult
- Firebase Analytics setup + tracking: firebase-analytics.md
- PostHog setup + tracking: posthog.md
- Common event taxonomy (what to track): event-taxonomy.md
Hard rules
- ✅ Track events with stable, snake_case names. Renaming an event later orphans the old data.
- ✅ Send the user ID after sign-in (
identify/setUserId) so events stitch across sessions. - ✅ Respect ATT denial on iOS — don't send IDFA-related identifiers when the user has denied tracking.
- ✅ For EU/UK users, defer analytics calls until consent is captured (see
../ionic-cmp-consent/— UMP returns analytics consent separately from ad consent). - ❌ Don't ship event names like
button_clicked_v2andbutton_clicked_v3— version your schema, not your event names. - ❌ Don't track PII (raw email, IP, full name) as event properties unless legal has approved.