Skip to main content

Events

attachEvent(element, evt, fn, useCapture)

Pendo agent’s version of attaching event listeners.

ParamTypeDescription
elementHTMLElementDOM element to attach listener
evtstringtype of DOM event
fnfunctioncallback function
useCaptureBooleanuse capture phase instead of bubble

Example

pendo.attachEvent(pendo.dom("h1")[0], 'click', helloWorld = () => { console.log(Hello World") });"

detachEvent(element, evt, fn, useCapture)

Pendo agent’s version of detaching event listeners. Callback must be a named function, cannot remove anonymous functions.

ParamTypeDescription
elementHTMLElementDOM element to attach listener
evtstringtype of DOM event
fnfunctioncallback function
useCaptureBooleanuse capture phase instead of bubble

Example

pendo.detachEvent(pendo.dom("h1")[0], 'click', helloWorld);

doNotProcess : string

If a visitor has been marked as "Do Not Process" then this value will be set to true.

Example

pendo.doNotProcess => true

flushNow(force) ⇒ void

This will force a flush of cached event objects.

ParamTypeDescription
forcebooleana "full" flush, i.e. ALL {pendo.buffers.silos}

Example

pendo.flushNow()

isSendingEvents() ⇒ Boolean

Returns true if event collection is currently enabled.

Example

pendo.stopSendingEvents()
pendo.isSendingEvents() => false
pendo.startSendingEvents()
pendo.isSendingEvents() => true

startSendingEvents()

Starts event collection and transmission.

Example

$ pendo.startSendingEvents()
> Pendo Agent unlocked. Events will be written.

stopSendingEvents()

Stops event collection and transmission.

Example

$ pendo.stopSendingEvents()
> Pendo Agent locked. No more events will be written.

track(name, [props])

Method to manually track events. Requires a non-empty name string to collect event.

ParamTypeDescription
namestringname of the collected event
[props]Objectoptional properties object to collect with to the event

Example

pendo.track('scroll')