Intercom Integration
Sanctiv uses Intercom for customer support, product tours, and user engagement tracking. This document covers setup, deep tracking capabilities, and best practices.Overview
Intercom provides:- In-app messaging - Support chat accessible from anywhere
- Help center - Self-service documentation
- Product tours - Guided onboarding flows
- User segmentation - Target specific user groups
- Support context - Rich data about user behavior before contacting support
Architecture
Setup
1. Environment Variables
Add to.env:
2. Edge Function for JWT
Thegenerate-intercom-jwt Supabase Edge Function creates secure JWT tokens for user verification:
3. Native Configuration
iOS - Add toios/sanctivmonorepo/Info.plist:
android/app/build.gradle:
Usage
Basic Event Tracking
Using the Unified Analytics Hook
TheuseAnalytics hook tracks to both PostHog and Intercom:
User Identification
Users are automatically identified on login:Showing Support
Product Tours & Surveys
Company Data (B2B)
Track organization-level data:Events Reference
Core Events
| Event | Description | Properties |
|---|---|---|
signed_in | User logged in | timestamp, platform |
signed_out | User logged out | timestamp |
app_opened | App launched | platform, app_version |
app_backgrounded | App sent to background | session_duration_seconds, screens_viewed |
screen_viewed | User viewed a screen | screen_name, timestamp |
Journal Events
| Event | Description | Properties |
|---|---|---|
journal_entry_created | New journal entry | word_count, method, template_id, has_ai_summary |
journal_entry_viewed | Entry opened | entry_id |
journal_entry_edited | Entry modified | entry_id, word_count |
journal_entry_deleted | Entry removed | entry_id |
Voice Events
| Event | Description | Properties |
|---|---|---|
voice_recording_started | Recording began | - |
voice_recording_completed | Recording finished | duration_seconds, method, processing_time_ms, word_count |
transcription_completed | Transcription successful | method, processing_time_ms |
transcription_failed | Transcription error | method, error_message |
Flow Events
| Event | Description | Properties |
|---|---|---|
flow_session_started | User began a flow | template_id, template_name |
flow_session_completed | Flow finished | template_id, duration_minutes, completion_rate |
flow_session_abandoned | Flow exited early | template_id, current_step |
Conversion Events
Use for tracking milestones and product goals:| Event | Description |
|---|---|
first_journal_created | User’s first journal entry |
first_flow_completed | User’s first guided flow |
first_companion_added | User’s first companion |
weekly_active | User active this week |
User Attributes
Attributes synced to Intercom for segmentation:Best Practices
1. Use Type-Safe Events
2. Sync Engagement Metrics Periodically
3. Provide Support Context
4. Use Unified Analytics Hook
For components that track to both PostHog and Intercom:5. Handle Expo Go Gracefully
Intercom requires native modules and won’t work in Expo Go:Troubleshooting
”Intercom not initialized”
Check:- Environment variables are set correctly
- Using development build (not Expo Go)
- Native modules are linked properly
JWT Verification Failing
Check:INTERCOM_IDENTITY_VERIFICATION_SECRETmatches Intercom dashboard- Supabase Edge Function is deployed
- User has valid session
Events Not Appearing
- Check Intercom dashboard for real-time events
- Verify user is registered (logged in)
- Check for console warnings
Related Documentation
- PostHog Setup - Product analytics integration
- Feature Inventory - All trackable features
- Sentry Setup - Error tracking integration