You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,23 @@ This release contains a number of major breaking changes:
6
6
- fix: remove `identify` (prefer `posthog.set()`), and `page` and `screen` (prefer `posthog.capture()`)
7
7
- fix: delete exception-capture specific integrations module. Prefer the general-purpose django middleware as a replacement for the django `Integration`.
8
8
9
+
To migrate to this version, you'll mostly just need to switch to using named keyword arguments, rather than positional ones. For example:
Set properties on a user record, only if they do not yet exist.
118
-
This will not overwrite previous people property values, unlike `identify`.
119
-
120
-
A `set_once` call requires
121
-
- `distinct id` which uniquely identifies your user
122
-
- `properties` with a dict with any key: value pairs
138
+
This will not overwrite previous people property values, unlike `set`.
123
139
124
-
For example:
125
-
```python
126
-
posthog.set_once('distinct id', {
127
-
'referred_by': 'friend',
128
-
})
140
+
Otherwise, operates in an identical manner to `set`.
129
141
```
130
142
"""
131
143
return_proxy("set_once", **kwargs)
@@ -146,7 +158,6 @@ def group_identify(
146
158
A `group_identify` call requires
147
159
- `group_type` type of your group
148
160
- `group_key` unique identifier of the group
149
-
- `properties` with a dict with any key: value pairs
150
161
151
162
For example:
152
163
```python
@@ -176,11 +187,10 @@ def alias(
176
187
):
177
188
# type: (...) -> Optional[str]
178
189
"""
179
-
To marry up whatever a user does before they sign up or log in with what they do after you need to make an alias call. This will allow you to answer questions like "Which marketing channels leads to users churning after a month?" or "What do users do on our website before signing up?"
180
-
181
-
In a purely back-end implementation, this means whenever an anonymous user does something, you'll want to send a session ID ([Django](https://stackoverflow.com/questions/526179/in-django-how-can-i-find-out-the-request-session-sessionid-and-use-it-as-a-vari), [Flask](https://stackoverflow.com/questions/15156132/flask-login-how-to-get-session-id)) with the capture call. Then, when that users signs up, you want to do an alias call with the session ID and the newly created user ID.
182
-
183
-
The same concept applies for when a user logs in.
190
+
To marry up whatever a user does before they sign up or log in with what they do after you need to make an alias call.
191
+
This will allow you to answer questions like "Which marketing channels leads to users churning after a month?" or
192
+
"What do users do on our website before signing up?". Particularly useful for associating user behaviour before and after
193
+
they e.g. register, login, or perform some other identifying action.
184
194
185
195
An `alias` call requires
186
196
- `previous distinct id` the unique ID of the user before
@@ -207,27 +217,26 @@ def capture_exception(
207
217
**kwargs: Unpack[OptionalCaptureArgs],
208
218
):
209
219
"""
210
-
capture_exception allows you to capture exceptions that happen in your code. This is useful for debugging and understanding what errors your users are encountering.
211
-
This function never raises an exception, even if it fails to send the event.
220
+
capture_exception allows you to capture exceptions that happen in your code.
221
+
222
+
Capture exception is idempotent - if it is called twice with the same exception instance, only a occurrence will be tracked in posthog.
223
+
This is because, generally, contexts will cause exceptions to be captured automatically. However, to ensure you track an exception,
224
+
if you catch and do not re-raise it, capturing it manually is recommended, unless you are certain it will have crossed a context
225
+
boundary (e.g. by existing a `with posthog.new_context():` block already)
212
226
213
-
A `capture_exception` call does not require any fields, but we recommend sending:
214
-
- `distinct id` which uniquely identifies your user for which this exception happens
227
+
A `capture_exception` call does not require any fields, but we recommend passing an exception of some kind:
215
228
- `exception` to specify the exception to capture. If not provided, the current exception is captured via `sys.exc_info()`
216
229
217
-
Optionally you can submit
218
-
- `properties`, which can be a dict with any information you'd like to add
219
-
- `groups`, which is a dict of group type -> group key mappings
220
-
- remaining `kwargs` will be logged if `log_captured_exceptions` is enabled
230
+
If the passed exception was raised and caught, the captured stack trace will consist of every frame between where the exception was raised
231
+
and the point at which it is captured (the "traceback").
221
232
222
-
For example:
223
-
```python
224
-
try:
225
-
1 / 0
226
-
except Exception as e:
227
-
posthog.capture_exception(e, 'my specific distinct id')
228
-
posthog.capture_exception(distinct_id='my specific distinct id')
233
+
If the passed exception was never raised, e.g. if you call `posthog.capture_exception(ValueError("Some Error"))`, the stack trace
234
+
captured will be the full stack trace at the moment the exception was captured.
229
235
230
-
```
236
+
Note that heavy use of contexts will lead to truncated stack traces, as the exception will be captured by the context entered most recently,
237
+
which may not be the point you catch the exception for the final time in your code. It's recommended to use contexts sparingly, for this reason.
238
+
239
+
`capture_exception` takes the same set of optional arguments as `capture`.
0 commit comments