Core SDK Events¶
The SDK does fire some events internally that you can then use to trigger dropping tags.
Also, some triggers you can configure on the Orbee Platform can then generate core SDK events to fire.
Both of these situations are documented here.
Core Events¶
The SDK fires the following core events:
"[SDK] Init"
: When a token initializes in the SDK"[SDK] History Changed"
: When page history is manipulated using thewindow.history
object
The Init
event puts the orb:t
datalayer variable in your state, which
references the timestamp at which the SDK initialized.
The History Changed
event includes multiple datalayer variables it writes to:
"orb:historyChangeSource"
is the event that triggered the history change -- e.g.pushState
orreplaceState
"orb:oldUrl"
is the URL before the history change"orb:newUrl"
is the current URL after the history change"orb:oldHistoryState"
is the state stored with the history object before the change"orb:newHistoryState"
is the current state stored with the history object after the change
Trigger Events¶
Some triggers cause core events to be fired to the SDK, adding context to the datalayer.
Element Visibility¶
Element visibility is a special trigger supported by the SDK. It fires the event
"[SDK] Element Visibility"
to the datalayer when an element becomes visible
and meets all other criteria of the trigger.
The Element Visibility
event sets the following datalayer variables:
"orb:visibleRatio"
is the visible ratio between 0 and 100 that triggered the event"orb:visibleTime"
is the time the element was visible before this event was triggered"orb:visibleFirstTime"
is the first timestamp the element was visible"orb:visibleLastTime"
is the last timestamp the element became visible"orb:element"
is a reference to the element itself that triggered this event"orb:elementClasses"
are the class names assigned to the elementsclassName
attribute"orb:elementId"
is the ID of the element that is visible"orb:triggers"
is the unique ID of the trigger that fired this event
Plugin Events¶
Plugins can additionally fire events and add state to the datalayer. If they are
generative, they fire to their own namespace which you can join
; otherwise,
you can subscribe to specific events from plugins via their available commands.