Event callbacks event-callbacks

The viewer supports JavaScript event callbacks that the web page uses to track the viewer initialization process or runtime behavior.

Callback handlers are assigned by passing event names and corresponding handler functions with the handlers property to config JSON object in the viewer’s constructor. Alternatively, it is possible to use setHandlers() API method.

Supported viewer events include the following:

  • initComplete - triggers when viewer initialization is complete and all internal components are created, so that it is possible to use getComponent() API. The callback handler does not take any arguments.

  • trackEvent - triggers each time an event occurs inside the viewer which may be handled by an event tracking system, such as Adobe Analytics. The callback handler takes the following arguments:

    • objID {String} not currently used.
    • compClass {String} not currently used.
    • instName {String} an instance name of the Viewer SDK component that triggered the event.
    • timeStamp {Number} event time stamp.
    • eventInfo {String} event payload.
  • quickViewActivate - triggers when a user clicks or taps on interactive swatch within the interactive swatches component or in the “call to action” screen shown in the end of video playback. Callback handler takes the only argument which is a JSON object with the following fields:

    • sku { String} SKU value that is associated with the interactive swatch.
    • <additionalVariable> { String} zero or more additional variables associated with the interactive swatch.

See also InteractiveVideoViewer and setHandlers.

recommendation-more-help
b7426f53-aad9-4c00-83fc-664f30f681e8