Events that never leave the device are invisible. Apps that reset the SDK when a user logs out, or stop session recording mid-session, often lose the last few actions before that moment, which are frequently the most telling ones.
PostHog iOS 3.92.0 changed this. Calling close() now sends queued events, session replay snapshots and logs instead of holding them until the next SDK setup. Calling stopSessionRecording() also sends snapshots already recorded. The same release ignores group(type:key:) calls with an empty type or key, and fixes $recording_status after a backgrounded session times out.
Data Points to Track
- flush_trigger: close, stopSessionRecording, background, or interval
- queued_event_count: events waiting when the flush began
- flush_duration_ms: time taken to send
- flush_result: success, failure, or timed out
- events_lost_estimate: gap between app-side and PostHog-side counts
- replay_snapshot_count: snapshots sent at stop
- empty_group_calls: group calls skipped for a blank type or key
- sdk_version: to compare before and after 3.92.0
Setup Steps
- Upgrade the iOS SDK to 3.92.0 or later.
- List every place you call
close()orstopSessionRecording(), such as logout or consent withdrawal. - Log a local counter of events fired before each call.
- Compare that counter with events received in PostHog for the same session.
- Check consent flows. Confirm a user who opts out is not sent data they refused. Order the calls deliberately.
- Audit group calls for empty values and fix the source.
- Review replay recordings around logout to confirm the final screens now appear.
Actionable Insights
A rise in events on logout screens after the upgrade is expected. It is data that was previously stuck, not new user behaviour. Annotate the date.
If flush duration is long on poor networks, do not block the user interface on it. Call close from a background task.
A high count of empty group calls shows a bug in how you set up accounts or organisations. Fix it, because those groups were previously attached to later events.
Common Pitfalls
Do not call close() as a routine reset on every screen. It is meant for shutting the SDK down. Also remember that sending on close is a consent matter: opt-out should happen before any flush you do not want.
Why Product Teams Should Care
Final-session behaviour often explains churn and logout reasons. Getting those events reliably makes exit analysis more trustworthy, but only if everyone knows when the change happened.
Testing Checklist
On a test device, fire a known number of events, then call close and check that every one arrives. Repeat on airplane mode, on a slow connection, and with the app sent to the background straight after. Note any case where events are still missing, and decide whether a retry or a longer background task is needed. Share the results with whoever owns your consent flow.