Class: ClickHouseProductAnalytics
Generated TypeDoc reference.
SDK and React Reference / sdk/src / ClickHouseProductAnalytics
Defined in: sdk/src/index.ts:66
Browser analytics client for capturing product events into the ingest service.
Constructors
Constructor
new ClickHouseProductAnalytics():
ClickHouseProductAnalytics
Returns
ClickHouseProductAnalytics
Methods
alias()
alias(
alias,original?):QueuedEvent|undefined
Defined in: sdk/src/index.ts:203
Link another distinct ID to the current or supplied original distinct ID.
Parameters
alias
string
original?
string = ...
Returns
QueuedEvent | undefined
capture()
capture(
eventName,properties?,options?):QueuedEvent|undefined
Defined in: sdk/src/index.ts:110
Capture a named event with optional properties.
Parameters
eventName
string
properties?
CaptureProperties | null
options?
CaptureOptions = {}
Returns
QueuedEvent | undefined
flush()
flush(
transport?):Promise<void>
Defined in: sdk/src/index.ts:300
Flush queued events using fetch or, when requested, sendBeacon.
Parameters
transport?
"fetch" | "sendBeacon"
Returns
Promise<void>
get_distinct_id()
get_distinct_id():
string
Defined in: sdk/src/index.ts:256
Return the current distinct ID.
Returns
string
get_property()
get_property(
property):unknown
Defined in: sdk/src/index.ts:269
Return a registered property value or the current distinct ID.
Parameters
property
string
Returns
unknown
get_session_id()
get_session_id():
string
Defined in: sdk/src/index.ts:262
Return the current session ID, rotating the session first if it has expired.
Returns
string
has_opted_out_capturing()
has_opted_out_capturing():
boolean
Defined in: sdk/src/index.ts:289
Return whether this client is currently opted out.
Returns
boolean
identify()
identify(
newDistinctId?,userPropertiesToSet?,userPropertiesToSetOnce?):void
Defined in: sdk/src/index.ts:159
Associate future events with a known user and optionally set person properties.
Parameters
newDistinctId?
string
userPropertiesToSet?
CaptureProperties = {}
userPropertiesToSetOnce?
CaptureProperties = {}
Returns
void
init()
Call Signature
init(
apiKey,config):this
Defined in: sdk/src/index.ts:75
Initialize the client with an ingest API key and browser SDK options.
Parameters
apiKey
string
config
Omit<InitOptions, "apiKey">
Returns
this
Call Signature
init(
config):this
Defined in: sdk/src/index.ts:77
Initialize the client with a complete options object. Allowed-origin browser requests can omit the API key.
Parameters
config
Returns
this
is_capturing()
is_capturing():
boolean
Defined in: sdk/src/index.ts:295
Return whether this client will enqueue new events.
Returns
boolean
opt_in_capturing()
opt_in_capturing():
void
Defined in: sdk/src/index.ts:282
Resume capturing events after an opt-out.
Returns
void
opt_out_capturing()
opt_out_capturing():
void
Defined in: sdk/src/index.ts:275
Stop capturing events until opt_in_capturing is called.
Returns
void
register()
register(
properties):void
Defined in: sdk/src/index.ts:228
Register properties that are attached to all future events.
Parameters
properties
Returns
void
register_once()
register_once(
properties,defaultValue?):void
Defined in: sdk/src/index.ts:238
Register properties only when their current value is absent or equal to defaultValue.
Parameters
properties
defaultValue?
unknown = 'None'
Returns
void
reset()
reset(
resetDeviceId?):void
Defined in: sdk/src/index.ts:208
Reset local identity and session state, optionally generating a new device ID.
Parameters
resetDeviceId?
boolean = false
Returns
void
setPersonProperties()
setPersonProperties(
userPropertiesToSet?,userPropertiesToSetOnce?):void
Defined in: sdk/src/index.ts:192
Set or set-once person properties for the current distinct ID.
Parameters
userPropertiesToSet?
CaptureProperties = {}
userPropertiesToSetOnce?
CaptureProperties = {}
Returns
void
shutdown()
shutdown():
void
Defined in: sdk/src/index.ts:306
Remove lifecycle listeners and stop queue timers.
Returns
void
unregister()
unregister(
property):void
Defined in: sdk/src/index.ts:249
Remove a registered super property from future events.
Parameters
property
string
Returns
void