woopra.track
:- Updated API to accept 3rd parameter as an object instead of a callback function
onError
callback optiononBeforeSend
callback option, receives aWoopraAction
object as an argumentonSuccess
callback option, receives aWoopraAction
object as an argumenttimeout
option (Number
, defaultwoopra.config('idle_timeout')
)queue
option (Boolean
)- When true, forces the action to be queued and sent as a beacon
- Uses
navigator.sendBeacon
instead of<script>
tag injection to make the tracking request - Queued actions are flushed and sent to woopra's tracking servers every time the user closes the tab/window or switches away from the tab, navigates away from the page,
woopra.push()
is called, an action has been cancelled or a file download/outgoing link/form track/click track event is captured.
lifecycle
option (String: "page" | "action"
)- Defaults to
page
forpv
, otherwiseaction
- Actions with
lifecycle
ofpage
will update durations through the lifecycle of the page - Actions with
lifecycle
ofpage
will be updated with the % of the page the user has seen upon scrolling
- Defaults to
retrack
option (Boolean
, defaultfalse
)- Actions with
lifecycle
ofpage
will be tracked again if the user is inactive longer thantimeout
. The action has the same properties with an extrareturning
property with the value oftrue
- Actions with
- Errors thrown in callbacks will be caught and logged via
console.error
woopra.update
:- New API to update existing actions using an ID of a
WoopraAction
woopra.update(id, { updated: 'property' });
- New API to update existing actions using an ID of a
woopra.cancelAction
:- New API to cancel actions with
lifecycle
ofpage
from further updating themselves using an ID of aWoopraAction
woopra.cancelAction(id);
- New API to cancel actions with
WoopraAction
:- Object returned from
onSuccess
andonBeforeSend
callbacks action.id
action.update({ updated: 'property' })
- Equivalent to
woopra.update(action.id, { updated: 'property' })
- Equivalent to
action.cancel()
- Equivalent to
woopra.cancelAction(action.id)
- Equivalent to
- Object returned from
woopra.config
beacons
(Boolean
, defaults to browser support)- Enable/disable usage of beacons
download_extensions
(Array
)- List of extensions (without '.') to treat as downloadable files
click_pause
(Number
, default250
)- Time in millisecond to pause the browser to ensure that the event is tracked when visitor clicks on an element decorated with
woopra.trackClick
. This value is ignored whenbeacons
are enabled.
- Time in millisecond to pause the browser to ensure that the event is tracked when visitor clicks on an element decorated with
form_pause
(Number
, default250
)- Time in millisecond to pause the browser to ensure that the event is tracked when visitor clicks on an element decorated with
woopra.trackForm
. This value is ignored whenbeacons
are enabled.
- Time in millisecond to pause the browser to ensure that the event is tracked when visitor clicks on an element decorated with
- Replace utility functions with cherry-picked
lodash-es
- Include https://github.com/GoogleChromeLabs/page-lifecycle inline to handle consistent browser behavior