Collecting Events
Flywheel supports two primary methods for collecting in-app user events:- PostHog Integration (Recommended)
- Segment Integration
User Profile Management
Both Segment and PostHog integrations process user profiles in accordance with their respective SDK/API conventions. When a user first signs in or signs up, anidentify
call is made to associate user data with their profile.
Supported User Properties
All properties in Flywheel usesnake_case
naming convention. The following properties can be passed with any event to enrich user profiles:
first_name
- User’s first namelast_name
- User’s last nameemail
- User’s email addressprimary_email
- Primary email address (automatically managed by Flywheel)phone
- User’s phone numberprimary_phone
- Primary phone number (automatically managed by Flywheel)stripe_customer_id
- Associated Stripe customer IDanonymous_id
- Anonymous identifier
Flywheel automatically sets the first email or phone number found for a user as their primary contact method. All subsequent emails and phone
numbers are stored but not set as primary. You can override the primary contact method at any time by explicitly passing
primary_email
or
primary_phone
- this will update the primary while maintaining a record of all previous contact information.PostHog Integration (Recommended)
Why PostHog?
- More favorable pricing model
- Rich feature set
- Better platform capabilities
- Open-source foundation
Example Implementation
Setting Up PostHog Data Forwarding
To start sending your PostHog event data to Flywheel, follow these steps:-
Enable Data Pipeline
- Navigate to the Data Pipeline section in your PostHog dashboard
- Enable the Data Pipeline if not already enabled
-
Configure HTTP Webhook
- Go to the Destinations section
- Click “New Destination”
- Select “HTTP Webhook”
-
Configure Webhook Settings
- Webhook URL:
-
- Method: Leave as default (POST)
- JSON Body: Leave as default PostHog value
- Webhook URL:
-
Add Required Headers
- Add the following headers:
Auth-Type: api
Authorization: your-flywheel-write-api-key
- Leave the Content-Type header as the PostHog default (
application/json; charset=utf-8
)
- Add the following headers:
-
Enable the Integration
- Save your configuration
- Enable the webhook
- Your events should now start appearing in your Flywheel dashboard
Segment Integration
Example Implementation
Setting Up Segment Data Forwarding
To start sending your Segment event data to Flywheel, follow these steps:- Access Segment Dashboard
- Navigate to your Segment dashboard
- Go to the Destinations page
- Click “Add Destination”
- Create Function
- Select the “Functions” tab at the top of the destinations page
- Click “New Function”
- Select “Destination Function” type
- Click “Next” to build the function
- Add Function Code
- Replace the default code with the following:
- Configure Settings
- Navigate to the Settings tab on the right side of the code editor
- Click “Add Setting”
- Configure the setting:
- Label:
apiKey
- Name:
apiKey
- Value: Your Flywheel API key
- Label:

- Test and Deploy
- Use Segment’s Function Tester to verify event forwarding
- Once testing is successful, save and deploy the function
Best Practices
User Identification
- Always call
identify
when a user signs up or logs in - Include essential user properties in the identify call
- Use consistent user IDs across your application
- Pass relevant custom properties to enrich user profiles
Troubleshooting
Common issues and solutions:- Events not appearing
- Verify API keys are correct
- Check integration configuration
- Ensure proper initialization
- User profiles not updating
- Verify identify calls are being made
- Check property names use snake_case format
- Ensure user IDs are consistent
- Missing event properties
- Validate event payload structure
- Check properties use snake_case format
- Verify property names match documentation