Skip to content

Commit 4753ddb

Browse files
committed
docs: state the option layer rules in capture docstrings
1 parent c5a2d18 commit 4753ddb

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎posthog/__init__.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ def get_context_options() -> Dict[str, Any]:
387387
an event's own properties override them.
388388
super_options: Capture options for every captured event, such as
389389
``{"cookieless_mode": True}``. Context options and an event's own
390-
``options`` override them.
390+
``options`` override them. They also win over an event's legacy
391+
property for the same key, such as ``$cookieless_mode``, so pass
392+
per-event overrides of that key as ``options``.
391393
metrics: Config dict for the ``client.metrics`` API (``service_name``,
392394
``service_version``, ``environment``, ``flush_interval``, ...). Applied
393395
when ``setup()`` builds the global client, or on a later ``setup()``

‎posthog/client.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,9 @@ def __init__(
803803
tags and an event's own properties override them.
804804
super_options: Capture options for every captured event, such as
805805
``{"cookieless_mode": True}``. Context options and an event's
806-
own ``options`` override them.
806+
own ``options`` override them. They also win over an event's
807+
legacy property for the same key, such as ``$cookieless_mode``,
808+
so pass per-event overrides of that key as ``options``.
807809
enable_exception_autocapture: Automatically capture uncaught
808810
exceptions.
809811
log_captured_exceptions: Also log exceptions captured by error
@@ -1326,6 +1328,9 @@ def set_context_option(self, key: str, value: Any) -> None:
13261328
"""
13271329
Set a capture option for every event captured within the current context.
13281330
1331+
Context options override ``super_options``. An event's own ``options``
1332+
override context options.
1333+
13291334
Args:
13301335
key: The option name, such as ``"process_person_profile"``.
13311336
value: The option value, sent as given.
@@ -1667,8 +1672,10 @@ def capture(
16671672
disable_geoip: Whether to disable GeoIP for this event.
16681673
options: Capture options for this event, such as
16691674
``{"process_person_profile": False}``. Sent as given, for
1670-
PostHog to validate. An option wins over its legacy ``$``
1671-
property, such as ``$process_person_profile``.
1675+
PostHog to validate. They override context options and
1676+
``super_options``. An option set at any layer wins over its
1677+
legacy ``$`` property, such as ``$process_person_profile``,
1678+
set at any layer. A ``None`` option counts as unset.
16721679
16731680
Examples:
16741681
```python

0 commit comments

Comments
 (0)