InvergeDocs
PythonAPI reference

Events

Product analytics — capture events correlated to a person and session.

// access
client.events

Product analytics — capture events correlated to a person and session.

Events

class

client.events

track() is buffered by default (NexusConfig.batch) and shipped on a background thread, so it costs microseconds in a request handler. Call flush (or client.flush()) to force delivery — the SDK also flushes at interpreter exit.

Extends Resource.

View source

track()

method
def track(name, properties=None, *, timestamp=None, distinct_id=None, session_key=None, device_key=None, release=None, app_version=None, os_type=None, os_version=None, browser=None, **extra_properties) -> None

Capture one event.

client.events.track("order_placed", {"total": 42, "currency": "USD"})
client.events.track("signup", plan="pro")       # kwargs become properties

timestamp is ISO-8601; omit it and the server stamps arrival time.

Parameters

Prop

Type

View source

batch()

method
def batch(events, *, distinct_id=None, session_key=None, device_key=None, release=None, app_version=None, os_type=None, os_version=None, browser=None) -> int

Send many events sharing one identity immediately (no buffering).

Each item is {"name": str, "properties": dict, "timestamp": str}. Returns the number of events the server wrote.

Parameters

Prop

Type

Returns int

View source

flush()

method
def flush(timeout=None) -> None

Ship everything buffered right now.

Parameters

Prop

Type

View source

capture

alias
capture = track

Alias of track.

View source

On this page