Expo SDK
Integrate Instalog into your Expo applications
Installation
Expo Config Plugin
This package auto-installs necessary native dependencies for Expo projects.
Android Configuration
For Android, make sure to add the Instalog Feedback Activity to your AndroidManifest.xml:
This should be placed inside the <application>
tags of your manifest file.
Usage
Initialization
Initialize Instalog at the beginning of your app, typically in your main App file:
User Identification
Identify your users to associate logged events and crashes with specific users:
Event Logging
Log specific events with optional properties:
User Feedback
Show a feedback modal to collect user feedback:
Crash Reporting
Crash reporting is automatically enabled after initialization. The SDK can automatically capture unhandled JavaScript errors when autoCaptureCrashes
is enabled (default).
You can also manually report crashes:
For more structured error reporting, you can use the formatErrorReport helper:
Global Error Handling
The SDK automatically sets up global error handling when initialized with autoCaptureCrashes: true
(default). This captures unhandled JavaScript errors and reports them to Instalog.
You can test this functionality with:
Test/Debug Methods
Advanced Configuration
Error Grouping
Instalog can group similar errors together to reduce noise in your error reports:
Common Issues
-
SDK Not Initialized
- Make sure to await the
initialize
call - Verify your API key is correct
- Make sure to await the
-
Missing Error Reports
- Check that
isCrashEnabled
is set to true - Verify network connectivity
- Check that
-
Expo Config Plugin Issues
- Ensure you’ve properly configured the plugin in your app.json
- Run
expo prebuild --clean
to ensure the plugin is applied
For additional support, please contact [email protected].
API Reference
Instalog
Method | Description |
---|---|
initialize(key, options) | Initializes the SDK with your API key and optional configuration |
identifyUser(userId) | Identifies the current user |
logEvent(event, params) | Logs an event with optional parameters |
sendCrash(error, stack) | Manually sends a crash report |
showFeedbackModal() | Shows the feedback collection modal |
simulateCrash() | Simulates a crash for testing |
formatErrorReport(error, errorInfo) | Formats an error into a structured report for sending |
Options
Option | Type | Default | Description |
---|---|---|---|
isLogEnabled | boolean | false | Enable event logging |
isLoggerEnabled | boolean | false | Enable debug logging |
isCrashEnabled | boolean | false | Enable crash reporting |
isFeedbackEnabled | boolean | false | Enable feedback collection |
autoCaptureCrashes | boolean | true | Automatically capture unhandled JS errors |
errorGrouping | object | See below | Configure how errors are grouped and reported |
Error Grouping Options
Option | Type | Default | Description |
---|---|---|---|
enabled | boolean | true | Enable error grouping |
flushIntervalMs | number | 30000 | Interval to flush error groups (ms) |
errorThreshold | number | 5 | Number of errors to trigger flush |
timeWindowMs | number | 60000 | Time window for grouping errors (ms) |
flushOnBackground | boolean | true | Flush errors when app goes to background |
requireNetwork | boolean | true | Only flush when network is available |
maxErrorsPerGroup | number | 10 | Max errors to store per group |
dynamicFlushInterval | boolean | true | Adjust flush interval based on error volume |