Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
027330f
feat!: send desktop events through capture v1
turnipdabeets Oct 26, 2026
e4e5781
fix(desktop): log capture v1 per-event rejections
turnipdabeets Oct 27, 2026
cdaefeb
docs: describe capture v1 for every platform in the 6.0 changeset
turnipdabeets Oct 27, 2026
e7eebba
fix(desktop): close capture v1 batches at 5 MiB of serialized events
turnipdabeets Oct 28, 2026
22d3e0e
fix: retry desktop capture v1 requests that get 404 or 429 (#678)
turnipdabeets Oct 28, 2026
cf0d1e2
feat(desktop): captureAi on the AI endpoint, native property order an…
turnipdabeets Oct 29, 2026
7abb005
Merge chore/v6-posthog-ios-4 into feat/v6-desktop-capture-v1
turnipdabeets Oct 29, 2026
33171f6
fix(desktop): recheck person processing after beforeSend adds person …
turnipdabeets Oct 29, 2026
daadc46
fix(desktop): apply person state only once an event is queued
turnipdabeets Oct 29, 2026
16ca4f8
Merge chore/v6-posthog-ios-4 into feat/v6-desktop-capture-v1
turnipdabeets Oct 30, 2026
f933404
docs: captureAiMaxEventBytes limits the whole event on Android too
turnipdabeets Oct 30, 2026
34754a7
fix(desktop): log event names and sizes, not properties, in debug mode
turnipdabeets Oct 30, 2026
4e7be56
fix(desktop): send the screen name beforeSend leaves
turnipdabeets Oct 30, 2026
bc39ec0
docs(desktop): registered and event properties override platform context
turnipdabeets Oct 30, 2026
2dee350
chore: stop passing RRStyle to replay screenshot frames (#684)
turnipdabeets Oct 29, 2026
155c048
chore!: adopt posthog-ios 4.0 and posthog-android 4.0 (#649)
turnipdabeets Oct 30, 2026
7d112a2
Merge remote-tracking branch 'origin/chore/v6-posthog-ios-4' into pha…
turnipdabeets Oct 31, 2026
8d1c1f4
Merge remote-tracking branch 'origin/chore/v6-posthog-ios-4' into pha…
turnipdabeets Oct 31, 2026
f2859c4
docs: fold capture v1 and native 4.0 release notes into the 6.0 docs
turnipdabeets Oct 31, 2026
7edf2cd
fix(desktop): skip phx_ keys, keep response bodies out of logs, count…
turnipdabeets Nov 2, 2026
61bc998
docs(migration): keep PostHog keys when a proxy strips Authorization
turnipdabeets Nov 2, 2026
b05555f
Merge chore/v6-posthog-ios-4 into feat/v6-desktop-capture-v1
turnipdabeets Nov 2, 2026
66f5fe9
test: pass the loaded flags to onFeatureFlags in the #694 desktop tests
turnipdabeets Nov 2, 2026
230e0f0
Merge remote-tracking branch 'origin/chore/v6-posthog-ios-4' into fea…
turnipdabeets Nov 3, 2026
3bd4aa0
perf(desktop): move queue file work and request compression off the U…
turnipdabeets Nov 3, 2026
f9e1698
feat!: make beforeSend callbacks synchronous (#686)
turnipdabeets Nov 3, 2026
faf8599
Merge chore/v6-posthog-ios-4 into feat/v6-desktop-capture-v1
turnipdabeets Nov 3, 2026
4517ca1
feat: add an onFeatureFlags listener you can unsubscribe (#670)
turnipdabeets Nov 3, 2026
0b49d5f
ci: run the capture v1 compliance suites against the real desktop cli…
turnipdabeets Nov 3, 2026
0d9204f
feat!: run beforeSend on the native-built event on iOS, macOS and And…
turnipdabeets Nov 3, 2026
d05722b
fix: send events with a lone surrogate on Windows and Linux (#703)
turnipdabeets Nov 3, 2026
fe95d8b
docs: link the capture v1 upgrade guide and cover capture v1 on every…
turnipdabeets Nov 3, 2026
353f1ae
fix(android): set PostHogEvent.options after copy
turnipdabeets Nov 4, 2026
e60a628
fix(desktop): resend a capture v1 retry alone to keep its request ide…
turnipdabeets Nov 5, 2026
e28f24f
feat!: report the device language as $locale and add $app_language (#…
turnipdabeets Nov 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions .changeset/v6-major-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,53 @@

- **Breaking:** bump the minimum iOS deployment target from 13.0 to 15.0 and macOS from 10.15 to 11.0 — see the [migration guide](https://github.com/PostHog/posthog-flutter/blob/main/posthog_flutter/MIGRATION.md)
- **Breaking:** remove CocoaPods support on iOS and macOS — install through Swift Package Manager, which needs Flutter 3.41 or later and doesn't support add-to-app modules yet
- **Breaking:** change `getFeatureFlagResult()` to follow `PostHogConfig.sendFeatureFlagEvent` on iOS, macOS, Android, Windows and Linux when `sendFeatureFlagEvent` is omitted — pass `sendFeatureFlagEvent: true` to keep capturing `$feature_flag_called`
- **Breaking:** rename `getFeatureFlagResult(sendEvent:)` to `getFeatureFlagResult(sendFeatureFlagEvent:)`
- **Breaking:** adopt `posthog-ios` 4.x, which requires Xcode 26
- **Breaking:** adopt `posthog-android` 4.x
- **Breaking:** remove `PostHogConfig.apiKey` and the `com.posthog.posthog.API_KEY` manifest and Info.plist key — use `projectToken` and `com.posthog.posthog.PROJECT_TOKEN`
- **Breaking:** remove `Posthog().enable()` and `Posthog().disable()` — use `optIn()` and `optOut()`
- **Breaking:** remove `Posthog().enable()` and `Posthog().disable()`, and rename `enable()` and `disable()` to `optIn()` and `optOut()` on `PosthogFlutterPlatformInterface`, `PosthogFlutterIO` and `PosthogFlutterWeb` — use `optIn()` and `optOut()`
- **Breaking:** remove `PostHogConfig.sendFeatureFlagEvents` — use `sendFeatureFlagEvent`
- **Breaking:** remove `Posthog().getFeatureFlagPayload()` — use `getFeatureFlagResult(key, sendFeatureFlagEvent: false)` and read `payload`
- **Breaking:** remove the `PostHogSessionReplayConfig.debouncerDelay` setter — use `throttleDelay`
- **Breaking:** remove `PostHogDataMode.cellular` — use `PostHogDataMode.any`
- **Breaking:** remove `toMap()` from the config classes and `PostHogFeatureFlagResult.fromMap()` from the public API
- **Breaking:** rename `enable()` and `disable()` to `optIn()` and `optOut()` on `PosthogFlutterPlatformInterface`, `PosthogFlutterIO` and `PosthogFlutterWeb`
- Declare Android `minSdkVersion` 23 to match `posthog-android`
- **Breaking:** send events to capture v1 (`/i/v1/analytics/events`) instead of `/batch/` on iOS, macOS, Android, Windows and Linux — update your reverse proxy first, see the [iOS](https://github.com/PostHog/posthog-ios/blob/main/MIGRATION.md#hosts-without-capture-v1) and [Android](https://github.com/PostHog/posthog-android/blob/main/docs/migration-3.x-to-4.0.md#hosts-without-capture-v1) migration guides
- **Breaking:** drop the batch on a redirect on Windows and Linux, following only same-origin 307 and 308 redirects, and cap a `Retry-After` wait at 30 seconds
- **Breaking:** write events to disk only when the returned future completes on Windows and Linux, so an unawaited call can be lost on a crash or `exit()` — await the call or `Posthog().close()` before `exit()`
- **Breaking:** apply SDK properties, then registered properties, then event properties on Windows and Linux, so your value wins for that event, and run `beforeSend` after that merge
- **Breaking:** always set `$lib` and `$lib_version` from the `PostHog-Sdk-Info` header on Windows and Linux, ignoring changes made in `beforeSend`
- **Breaking:** send person processing as the `process_person_profile: false` option on Windows and Linux, only while it's off, instead of a `$process_person_profile` property on every event
- **Breaking:** make `beforeSend` and `logsConfig.beforeSend` callbacks synchronous — load what they need ahead of time instead of using `await`
- **Breaking:** pass `beforeSend` callbacks the event the native SDK built on iOS, macOS and Android, with its system and registered properties, and make their changes final
- **Breaking:** decide person processing before `beforeSend` runs on iOS, macOS, Android, Windows and Linux — a callback that removes `$set` no longer prevents a person profile, and a callback that adds `$set` to an anonymous event must also set the `process_person_profile: true` option
- **Breaking:** remove `PostHogConfig.onFeatureFlags` — call `Posthog().onFeatureFlags((loaded) { ... })` before `setup()` instead, which also covers the first load and returns a `PostHogFeatureFlagsSubscription` you can `unsubscribe()`
- **Breaking:** return the reloaded flags from `reloadFeatureFlags()` as a `Future<PostHogFeatureFlagsLoaded>`
- **Breaking:** rename `getFeatureFlagResult(sendEvent:)` to `getFeatureFlagResult(sendFeatureFlagEvent:)`
- **Breaking:** change `getFeatureFlagResult()` to follow `PostHogConfig.sendFeatureFlagEvent` on iOS, macOS, Android, Windows and Linux when `sendFeatureFlagEvent` is omitted — pass `sendFeatureFlagEvent: true` to keep capturing `$feature_flag_called`
- **Breaking:** return `null` instead of the raw string for a malformed, empty or whitespace-only `getFeatureFlagResult()` payload on iOS, macOS and Android
- **Breaking:** keep string payloads passed to `PostHogBootstrapConfig.featureFlagPayloads`, such as `"123"`, as strings on iOS and macOS instead of decoding them to numbers or booleans
- **Breaking:** change `$locale` to the device's language with its region, such as `de-CH` instead of `de`, on iOS, macOS, Windows and Linux, follow a language picked for the app in Settings on iOS and macOS, and stop it following a per-app language on Android — update filters that match it
- **Breaking:** stop sending the legacy `version` and `build` properties on `Application Installed`, `Application Updated` and `Application Opened` on iOS and macOS — use `$app_version` and `$app_build`
- Add an `options` parameter to `capture`, `screen`, `identify`, `setPersonProperties`, `alias`, `group` and `captureException`, and `PostHogEvent.options` for `beforeSend` callbacks
- Add `PostHogEvent.uuid`, `distinctId` and `timestamp`, set before `beforeSend` runs on every platform except web — a callback can change the distinct ID and timestamp, and the event keeps its uuid
- Add `PosthogFlutterPlugin.addBeforeSend` in Swift and Kotlin to filter or edit events the native SDK captures itself, such as crashes, app lifecycle and `$feature_flag_called` events
- Add `captureAi` for AI observability events, a no-op that returns `null` on web
- Add `PostHogConfig.captureAiCompression`, `captureAiMaxQueueSize`, `captureAiTimeout` and `captureAiMaxEventBytes`
- Add the `$app_language` property, reported by `PosthogObserver` from the locale `MaterialApp` resolved, and `setAppLanguage()` to set it yourself
Comment thread
turnipdabeets marked this conversation as resolved.
Resolved
- Add a `defaultValue` option to `isFeatureEnabled()`, returned when the flag has no value
- Declare Android `minSdkVersion` 23 to match `posthog-android`
- Skip `setup()` with one log line when `projectToken` is a personal API key (`phx_`), so the key is never sent
- Skip SDK calls with a warning instead of throwing when they run before the Flutter binding is initialized on iOS, macOS and Android
- Keep a `reset()`, `identify()` or `optOut()` made right after an un-awaited `capture()`, `screen()`, `captureException()`, `captureFeatureView()` or `captureFeatureInteraction()` from applying to that event first, and stop dropping that event on Windows and Linux
- Run a `beforeSend` callback that renames a screen or exception event once, and keep its `userProperties`
- Keep `userProperties` and `userPropertiesSetOnce` that a `beforeSend` callback sets on a screen or exception event on web
- Send an event as its original user when a `beforeSend` callback calls `reset()` or `identify()` on Windows and Linux, instead of dropping it, and on web, instead of sending it as the new user
- Attach `$exception_steps` before `beforeSend` runs on Windows and Linux so callbacks can read or remove them — steps recorded while a callback runs, or an event a callback renames to `$exception`, no longer get them
- Retry a 404 on Windows and Linux so events stay queued, printing one warning, also without `debug`, until a reverse proxy or self-hosted instance serves the new path
- Apply a `$process_person_profile` property or `process_person_profile` option passed with an event to that event on Windows and Linux
- Replace lone UTF-16 surrogates with U+FFFD on Windows and Linux, in event names, ids, properties and options, and in the person and group properties sent for feature flags, so one such event no longer loses its whole batch; iOS, macOS and Android already send them that way
- Back off failed sends on Windows and Linux from 1 second up to 30 seconds with ±25% jitter, instead of resending within the flush, treating `Retry-After` as a floor
- Drop a batch whose 2xx response has no readable per-event results on Windows and Linux instead of counting it as delivered, without resending it
- Log one line per batch that lost events on Windows and Linux, with the endpoint, count and reasons, also for a terminal status, and count a `limited` result as delivered
- Stop printing capture's response body in flush error logs on Windows and Linux, and log how many repeated-uuid copies capture dropped
- Run queued event encoding, file work and request compression on a background isolate on Windows and Linux so they no longer drop frames
- Limit AI events waiting to be written on Windows and Linux to about 50 MiB in memory, dropping the oldest first and completing `captureAi` with `null` for them
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
- name: Test compliance adapter
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
working-directory: ./sdk_compliance_adapter
run: flutter test test/feature_flag_has_experiment_test.dart test/flags_retry_test.dart test/minimal_flag_called_events_test.dart test/timestamp_test.dart
run: flutter test test/feature_flag_has_experiment_test.dart test/flags_retry_test.dart test/minimal_flag_called_events_test.dart test/recording_proxy_test.dart test/timestamp_test.dart

# Browser-only tests (`@TestOn('browser')`) are skipped by the VM run above.
- name: Test (web)
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/sdk-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ on:
jobs:
compliance:
name: PostHog SDK compliance tests
uses: PostHog/posthog-sdk-test-harness/.github/workflows/test-sdk-action.yml@27806196fa5c5ac74e9e7500bc46b74db1869f3a # main @ 2026-07-27
uses: PostHog/posthog-sdk-test-harness/.github/workflows/test-sdk-action.yml@c90b42dbe2235c89aad3b4dddf74f520a8c6c747 # 1.26.0
with:
adapter-dockerfile: "sdk_compliance_adapter/Dockerfile"
adapter-context: "."
test-harness-version: "0.9.0"
test-harness-version: "1.26.0"
continue-on-error: false
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ make checkFormatSwift
(cd posthog_flutter && flutter test)
(cd posthog_flutter && flutter test --platform chrome test/posthog_flutter_web_handler_test.dart test/posthog_flutter_web_setup_test.dart test/posthog_widget_web_test.dart test/posthog_widget_test.dart test/web_before_send_test.dart test/web_canvas_mask_provider_test.dart)
(cd posthog_flutter && flutter test --platform chrome --wasm test/posthog_isolate_error_handler_web_test.dart)
(cd sdk_compliance_adapter && flutter test test/feature_flag_has_experiment_test.dart test/flags_retry_test.dart test/minimal_flag_called_events_test.dart test/timestamp_test.dart)
(cd sdk_compliance_adapter && flutter test test/feature_flag_has_experiment_test.dart test/flags_retry_test.dart test/minimal_flag_called_events_test.dart test/recording_proxy_test.dart test/timestamp_test.dart)
```

The adapter's `test/adapter_server_test.dart` is the long-running compliance server,
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ file untouched. A new client can try reading the file again. Corrupt file
contents reset the state to defaults; the next state write replaces the file.

`Posthog().close()` makes one attempt to send the queued events and waits for it
for up to two seconds. Events it could not send stay on disk and go out with the
next client, or are lost when state is kept in memory. Closing the app window
does not call `close()`, but the SDK also sends the queue whenever the app
becomes inactive.
for up to two seconds, and for the queue's files for up to two more. Events it
could not send stay on disk and go out with the next client, or are lost when
state is kept in memory. Events are written in the background, so await
`close()` before calling `exit()`; awaiting a capture or `identify` call also
keeps that call's event. Closing the app window does not call `close()`, but the
SDK also sends the queue whenever the app becomes inactive.

## Questions?

Expand Down
Loading
Loading