-
Notifications
You must be signed in to change notification settings - Fork 53
feat: prep for 6.0.0, bunch of breaking changes #273
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
Changes from all commits
68fdfa5
b41b911
ca29138
71b9ff3
88b0a9a
dd218ee
0015fce
da395dd
5a4e12d
1755727
fcfb9c7
fca65f7
462497b
eaa1e18
f256e19
c057bf0
7fb1484
7de2ef3
fec4925
a2b4bf5
1ec0c33
757ace5
3ca6019
1c1c528
572f08a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,28 @@ | ||
| # 6.0.0 | ||
|
|
||
| This release contains a number of major breaking changes: | ||
| - feat: make distinct_id an optional parameter in posthog.capture and related functions | ||
| - feat: make capture and related functions return `Optional[str]`, which is the UUID of the sent event, if it was sent | ||
| - fix: remove `identify` (prefer `posthog.set()`), and `page` and `screen` (prefer `posthog.capture()`) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the thinking behind removing these methods?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, identify is removed because it's semantically confusing - we should push people towards identifying at the context level always. Re: page, my impression is pageview is generally captured by the frontend?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Several people prefer to use a backend-only instrumentation, this being a framework integration for a non-SPA website (e.g: only django/flask views - not using our utilities) or doing it all themselves on their backend. I think that using context + capture is enough for them; it is also a more focused API, so I personally prefer it. |
||
| - fix: delete exception-capture specific integrations module. Prefer the general-purpose django middleware as a replacement for the django `Integration`. | ||
|
|
||
| To migrate to this version, you'll mostly just need to switch to using named keyword arguments, rather than positional ones. For example: | ||
| ```python | ||
| # Old calling convention | ||
| posthog.capture("user123", "button_clicked", {"button_id": "123"}) | ||
| # New calling convention | ||
| posthog.capture(distinct_id="user123", event="button_clicked", properties={"button_id": "123"}) | ||
|
|
||
| # Better pattern | ||
| with posthog.new_context(): | ||
| posthog.identify_context("user123") | ||
|
|
||
| # The event name is the first argument, and can be passed positionally, or as a keyword argument in a later position | ||
| posthog.capture("button_pressed") | ||
| ``` | ||
|
|
||
| Generally, arguments are now appropriately typed, and docstrings have been updated. If something is unclear, please open an issue, or submit a PR! | ||
|
|
||
| # 5.4.0 - 2025-06-20 | ||
|
|
||
| - feat: add support to session_id context on page method | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,9 +41,9 @@ | |
|
|
||
| # Capture an event | ||
| posthog.capture( | ||
| "distinct_id", | ||
| "event", | ||
| {"property1": "value", "property2": "value"}, | ||
| distinct_id="distinct_id", | ||
| properties={"property1": "value", "property2": "value"}, | ||
| send_feature_flags=True, | ||
| ) | ||
|
|
||
|
|
@@ -65,31 +65,35 @@ | |
| posthog.alias("distinct_id", "new_distinct_id") | ||
|
|
||
| posthog.capture( | ||
| "new_distinct_id", "event2", {"property1": "value", "property2": "value"} | ||
| "event2", | ||
| distinct_id="new_distinct_id", | ||
| properties={"property1": "value", "property2": "value"}, | ||
| ) | ||
| posthog.capture( | ||
| "new_distinct_id", | ||
| "event-with-groups", | ||
| {"property1": "value", "property2": "value"}, | ||
| distinct_id="new_distinct_id", | ||
| properties={"property1": "value", "property2": "value"}, | ||
| groups={"company": "id:5"}, | ||
| ) | ||
|
|
||
| # # Add properties to the person | ||
| posthog.identify("new_distinct_id", {"email": "[email protected]"}) | ||
| posthog.set( | ||
| distinct_id="new_distinct_id", properties={"email": "[email protected]"} | ||
| ) | ||
|
|
||
| # Add properties to a group | ||
| posthog.group_identify("company", "id:5", {"employees": 11}) | ||
|
|
||
| # properties set only once to the person | ||
| posthog.set_once("new_distinct_id", {"self_serve_signup": True}) | ||
| posthog.set_once(distinct_id="new_distinct_id", properties={"self_serve_signup": True}) | ||
|
|
||
|
|
||
| posthog.set_once( | ||
| "new_distinct_id", {"self_serve_signup": False} | ||
| distinct_id="new_distinct_id", properties={"self_serve_signup": False} | ||
| ) # this will not change the property (because it was already set) | ||
|
|
||
| posthog.set("new_distinct_id", {"current_browser": "Chrome"}) | ||
| posthog.set("new_distinct_id", {"current_browser": "Firefox"}) | ||
| posthog.set(distinct_id="new_distinct_id", properties={"current_browser": "Chrome"}) | ||
| posthog.set(distinct_id="new_distinct_id", properties={"current_browser": "Firefox"}) | ||
|
|
||
|
|
||
| # ############################################################################# | ||
|
|
||
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.
Might be worth adding a migration guide somewhere telling people the main things needed to migrate from v4 / v5 to v6