Repository navigation
feat!: send analytics events through capture v1 #938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
+2,214
−259
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
2e46974
feat!: send analytics events through capture v1
turnipdabeets c1850fd
chore: declare capture_v1 in the compliance adapter
turnipdabeets ef924f0
chore: document capture auth header, cover fallback retry policy, map…
turnipdabeets 32ef0b9
chore: log dropped duplicate UUIDs, cover a failing /batch fallback, …
turnipdabeets 27469d7
fix: follow capture redirects only to the configured origin
turnipdabeets 804b1e9
feat!: add per-event capture options
turnipdabeets bc85281
docs: clarify capture options precedence and the Retry-After cap
turnipdabeets 9007cf6
chore: track capture V1 requests in the compliance adapter
turnipdabeets 1505ffb
docs: note the Retry-After cap applies to every queue and 413 still s…
turnipdabeets 5852d90
docs: rewrite the capture V1 changeset as changelog entries
turnipdabeets fad2204
test: stop the capture redirect tests racing the HTTP stubs
turnipdabeets d5fc585
fix: resend a capture V1 batch whose transfer failed after a 2xx
turnipdabeets fef9de3
refactor: stop deduplicating event UUIDs before capture
turnipdabeets 29503f3
docs: add the 4.0 capture v1 migration guide
turnipdabeets 81fed4c
fix: give each capture its own UUID when beforeSend returns an earlie…
turnipdabeets f04315e
fix(queue): back off exponentially with jitter between failed sends
turnipdabeets 17751d7
docs: describe the jittered exponential backoff in the 4.0 migration …
turnipdabeets 564b9df
feat(config): rename maxRetries to pushNotificationSubscriptionMaxRet…
turnipdabeets 621bb26
refactor(config)!: drop the deprecated maxRetries alias
turnipdabeets b0636c9
fix(capture): send empty session and window IDs and log dropped non-s…
turnipdabeets ce3ba68
fix: treat a capture V1 2xx whose results can't be read as delivered
turnipdabeets b10cabc
fix: send process_person_profile only when person processing is off
turnipdabeets 08a631b
docs: describe how 4.0 sends process_person_profile in the migration …
turnipdabeets 02be3d5
test(compliance): run the adapter with personProfiles = .always
turnipdabeets 68d328c
feat!: accept options on screen, identify, alias, group and captureEx…
turnipdabeets 1491001
fix: don't deduplicate person properties sent without person processing
turnipdabeets a9c3065
fix: use the current distinct ID for a blank distinctId argument
turnipdabeets 25fbf00
fix: disable the SDK when projectToken is a personal API key
turnipdabeets 9367a2e
docs: mark the migration guide to link the public capture v1 guide
turnipdabeets 31a80cb
feat!: let event properties override the SDK's own values
turnipdabeets 74d8c21
feat!: let super properties override properties the SDK sets
turnipdabeets 44cf275
docs: fix what beforeSend sees for $lib and note registered $session_id
turnipdabeets b50af50
test: send both GeoIP override events in one batch
turnipdabeets 2b7cbd7
fix: let per-call $set, $set_once and groups win over registered ones
turnipdabeets File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': minor | ||
| --- | ||
|
|
||
| Add per-event capture options with `capture(..., timestamp:options:)` and `PostHogEvent.options`, which `beforeSend` can read and change. `screen`, `identify`, `setPersonProperties`, `alias`, `group` and `captureException` take the same `options` argument. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** send events to capture V1 (`/i/v1/analytics/events`) with the project token in an `Authorization: Bearer` header. | ||
|
|
||
| - If you use a reverse proxy, forward `/i/v1/analytics/events`. A 404 falls back to `/batch` until the app restarts; other errors such as 403 or 405 drop the events. | ||
| - Capture requests replace any `Authorization` header from `requestHeaders`, so authenticate your proxy with a different header. | ||
| - Only a 307 or 308 redirect to the same origin as `host` is followed, at most 5 times. Other redirects drop the events, so point `host` at the final host. | ||
| - 429 responses are no longer retried, and `Retry-After` pauses sending for at most 30 seconds, including session replay and logs. | ||
| - After a failed send, the wait before the next one now doubles from 1 second up to 30 seconds, with up to 25% random jitter, instead of growing by 1 second per failure. This applies to events, session replay and logs, and queued records are still kept until they're delivered. | ||
| - `maxRetries` is renamed to `pushNotificationSubscriptionMaxRetries`, because it only limits push-notification subscription retries. Event, session replay and log retries still have no limit. | ||
| - The `$process_person_profile`, `$cookieless_mode`, `$ignore_sent_at` and `$product_tour_id` properties are sent as capture options, and PostHog drops an event whose option value it can't read. | ||
| - Event properties are merged as: properties the SDK sets itself, then registered super properties, then the properties you pass, then `beforeSend`. Super properties now override SDK properties such as `$os`, and both super and event properties override `$is_identified`, `$process_person_profile`, `$geoip_disable` and the session replay debug values. | ||
|
|
||
| See the [migration guide](https://github.com/PostHog/posthog-ios/blob/main/docs/migration-3.x-to-4.0.md) for what to check before you upgrade. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1 is strict about dropping events with missing names or distinct_ids, or if either exceeds 200 bytes in size (legacy backend already silently enforces this) we should probably mention this in the migration guide. If you like I can add that migration guide to your feature branch after all these PRs land? I'm still making parity updates locking decisions as Rust/Go/Python v1 open PRs land, but I've got similar guides drafted in PRs on those v1 SDK branches as an example. General new requirements will be covered in the new draft public docs for release to avoid duplication. let me know what you think or if this should be a follow on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an iOS migration guide here, modeled on yours: https://github.com/PostHog/posthog-ios/blob/feat/v4-capture-v1/docs/migration-3.x-to-4.0.md - let me know how this looks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! Can the guide get a hidden TODO to link the public capture v1 SDK upgrade guide (PostHog/posthog.com#21386) for details once it's published? The Go, Python and Rust guides carry the same marker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 1963f5d, same marker as the Go, Python and Rust guides.