Class s7sdk.event.UserEvent
A UserEvent
is dispatched by the SDK Viewer components when a user-initiated action occurs.
These events are typically used for tracking purposes. The TrackingManager
uses the disabletracking
and enabletracking
parameters that are
associated with a specific component to determine which event types - trackEvent
-
to dispatch. If these parameters are not included, all UserEvent event types create
JavaScript calls. See the TrackingManager documentation for more information.
You can add UserEvent
event listeners to the HTML element where the viewer
resides, or to the upper-level window object. TrackingManager is not required when handling
UserEvent
events.
In the UserEvent.NOTF_USER_EVENT handler, the event has a property called event.s7event
that contains the pertinent event data.
Constructor Attributes | Constructor Name and Description |
---|---|
s7sdk.event.UserEvent(trackEvent, data, bubbles)
|
Field Attributes | Field Name and Description |
---|---|
<static> |
s7sdk.event.UserEvent.AUDIO_CHANGE
Defines the value of the
trackEvent property for a AUDIO_CHANGE event object. |
<static> |
s7sdk.event.UserEvent.BANNER
Defines the value of the
trackEvent property for a BANNER event object. |
<static> |
s7sdk.event.UserEvent.CURRENT_TIME
Defines the value of the
trackEvent property for a CURRENT_TIME event object. |
<static> |
s7sdk.event.UserEvent.FULLSCREEN
Defines the value of the
trackEvent property for a FULLSCREEN event object. |
<static> |
s7sdk.event.UserEvent.HREF
Defines the value of the
trackEvent property for an HREF event object. |
<static> |
s7sdk.event.UserEvent.INTERACTIVE_SWATCH
Defines the value of the
trackEvent property for a INTERACTIVE_SWATCH event object. |
<static> |
s7sdk.event.UserEvent.INTERACTIVE_THUMBNAIL_GRID_VIEW_SWATCH
Defines the value of the
trackEvent property for a INTERACTIVE_THUMBNAIL_GRID_VIEW_SWATCH event object. |
<static> |
s7sdk.event.UserEvent.ITEM
Defines the value of the
trackEvent property for an ITEM event object. |
<static> |
s7sdk.event.UserEvent.LOAD
Defines the value of the
trackEvent property for a LOAD event object. |
<static> |
s7sdk.event.UserEvent.METADATA
Defines the value of the
trackEvent property for a METADATA event object. |
<static> |
s7sdk.event.UserEvent.MILESTONE
Defines the value of the
trackEvent property for a MILESTONE event object. |
<static> |
s7sdk.event.UserEvent.MUTE
Defines the value of the
trackEvent property for a MUTE event object. |
<static> |
s7sdk.event.UserEvent.NOTF_USER_EVENT
Defines the value of the
type property for a UserEvent event object. |
<static> |
s7sdk.event.UserEvent.PAGE
Defines the value of the
trackEvent property for a PAGE event object. |
<static> |
s7sdk.event.UserEvent.PAN
Defines the value of the
trackEvent property for a PAN event object. |
<static> |
s7sdk.event.UserEvent.PAUSE
Defines the value of the
trackEvent property for a PAUSE event object. |
<static> |
s7sdk.event.UserEvent.PLAY
Defines the value of the
trackEvent property for a PLAY event object. |
<static> |
s7sdk.event.UserEvent.PLAYBACK_COMPLETE
Defines the value of the
trackEvent property for a PLAYBACK_COMPLETE event object. |
<static> |
s7sdk.event.UserEvent.PLAYBACK_ERROR
Defines the value of the
trackEvent property for a PLAYBACK_ERROR event object. |
<static> |
s7sdk.event.UserEvent.RECORD
Defines the value of the
trackEvent property for a RECORD event object. |
<static> |
s7sdk.event.UserEvent.REPLAY
Defines the value of the
trackEvent property for a REPLAY event object. |
<static> |
s7sdk.event.UserEvent.SOCIAL_SHARING
Defines the value of the
trackEvent property for a SOCIAL_SHARING event object. |
<static> |
s7sdk.event.UserEvent.SPIN
Defines the value of the
trackEvent property for a SPIN event object. |
<static> |
s7sdk.event.UserEvent.STOP
Defines the value of the
trackEvent property for a STOP event object. |
<static> |
s7sdk.event.UserEvent.SUBTITLE_CHANGE
Defines the value of the
trackEvent property for a SUBTITLE_CHANGE event object. |
<static> |
s7sdk.event.UserEvent.SWAP
Defines the value of the
trackEvent property for a SWAP event object. |
<static> |
s7sdk.event.UserEvent.SWATCH
Defines the value of the
trackEvent property for a SWATCH event object. |
<static> |
s7sdk.event.UserEvent.TARG
Defines the value of the
trackEvent property for a TARG event object. |
<static> |
s7sdk.event.UserEvent.UN_FULLSCREEN
Defines the value of the
trackEvent property for a UN_FULLSCREEN event object. |
<static> |
s7sdk.event.UserEvent.UNMUTE
Defines the value of the
trackEvent property for a UNMUTE event object. |
<static> |
s7sdk.event.UserEvent.ZOOM
Defines the value of the
trackEvent property for a ZOOM event object. |
Method Attributes | Method Name and Description |
---|---|
Returns a copy of the data array in which the items are the respective URI encoded strings.
|
|
toString()
Returns a string that contains all the properties of the
UserEvent object. |
UserEvent example To see what events are emitted from a viewer, this example logs all UserEvent objects using the UserEvent.toString() function:window.addEventListener(s7sdk.event.UserEvent.NOTF_USER_EVENT, function(event) {console.log("UserEvent - " + event.s7event.toString());}, false);
TheaddEventListener
call is made from one of thes7sdk.Event.SDK_READY
listener functions.
- Parameters:
- trackEvent
- data
- bubbles
trackEvent
property for a AUDIO_CHANGE
event object.
The data that is associated with this event type is "role, label" which results in the following output string:
AUDIO_CHANGE, rolelabel
The event is dispatched when audio is changed from audio captions menu.trackEvent
property for a BANNER
event object.
The data that is associated with this event type is "banner image name, banner number (position in the set), banner title (if available)" which results in the following output string:
BANNER, banner image name, banner number (position in the set), banner title (if available)
Where banner number is the current frame, and banner title is the label that is associated with the asset in the frame. If no label is present then this value returns empty. The event is dispatched by theCarouselView
component when image is changed inside the component.
trackEvent
property for a CURRENT_TIME
event object.
The data that is associated with this event type is "timestamp" which results in the following output string:
CURRENT_TIME, timestamp
Where timestamp is the video time in milliseconds when the event occurs, if known (real). The event is dispatched each time the current video time is changed.trackEvent
property for a FULLSCREEN
event object.
The data that is associated with this event type is "width, height" which results in the following output string:
FULLSCREEN, width, height
The event is dispatched when the viewer is fullscreen as a result of user interaction.trackEvent
property for an HREF
event object.
The data that is associated with this event type is "rollover_key | href | altText" which results in the following output string:
HREF, rollover_key | href | altText
The rollover_key value from the image map is returned if available, if not the href value is used if present otherwise the altText value is returned. If none of these three values is present the event is not emitted. This event is emitted when the user clicks on an image map area.trackEvent
property for a INTERACTIVE_SWATCH
event object.
The data that is associated with this event type is the "href" of that swatch.
The event is dispatched when the user clicks an interactive swatch.
trackEvent
property for a INTERACTIVE_THUMBNAIL_GRID_VIEW_SWATCH
event object.
The data that is associated with this event type is the "href" of that swatch.
The event is dispatched when the user clicks an interactive thumbnail grid view swatch.
trackEvent
property for an ITEM
event object.
The data that is associated with this event type is "rollover_key | href | altText" which results in the following output string:
ITEM, rollover_key | href | altText
The rollover_key value from the image map is returned if available, if not the href value is used if present otherwise the altText value is returned. If none of these three values is present the event is not emitted. This event is emitted when the user moves into an image map area.trackEvent
property for a LOAD
event object.
The data that is associated with this event type is "viewer type, viewer name, viewer version, sdk version, company, asset" which results in the following output string:
LOAD, viewer type, viewer name, viewer version, sdk version, company, asset
Where viewer type is a string that specifies the type of viewer. By default it is set tos7_html5_sdk
. You can specify the viewer type in the viewer
property of the ParameterManager
. The
page name is the name of the html wrapper that contains the component instance that is throwing the event. In this case, the instance of
the ParameterManager
. The viewer version is the version that is set in the viewer
property of the ParameterManager
.
It defaults to unknown
. The company and the asset refer to the company that the viewer is served for, and the main asset that is displayed
in the viewer. The sdk version is the SDK version upon which the viewer is based.
trackEvent
property for a METADATA
event object.
The data that is associated with this event type for video content is:
METADATA, event type, video length or playhead
event type can be eitherDURATION
or SEEK
. If event type is DURATION
the third value will be video length. If it is SEEK
, the third value will be time
seeked to in the video.
This event is not used for other asset types.
trackEvent
property for a MILESTONE
event object.
The data that is associated with this event type is "25 | 50 | 75 | 100" which results in the following output string:
MILESTONE, percentage of playback
Where percentage of playback is the percentage of video play completed. The event is dispatched by theVideoPlayer
component when the video player reaches 25, 50, 75 and 100 percent of video play.
trackEvent
property for a MUTE
event object.
The data that is associated with this event type is "timestamp" which results in the following output string:
MUTE, timestamp
Where timestamp is the video time in milliseconds when the event occurs, if known (real). The event is dispatched when the video is muted as a result of user interaction.type
property for a UserEvent
event object.
trackEvent
property for a PAGE
event object.
The data that is associated with this event type is "frame, page label" which results in the following output string:
PAGE, frame, page label
Where frame is the current frame, and page label is the label that is associated with the asset in the frame. If no label is present then this value returns empty. The event is dispatched by thePageView
component in the
frameChanged handler after every nextPage except for the initial page loaded.
- See:
- s7sdk.set.PageView
trackEvent
property for a PAN
event object.
PAN
The event is dispatched when pan is triggered on the image.trackEvent
property for a PAUSE
event object.
The data that is associated with this event type is "timestamp" which results in the following output string:
PAUSE, timestamp
Where timestamp is the video time in milliseconds when the event occurs, if known (real). The event is dispatched when the movie is paused as a result of user interaction.trackEvent
property for a PLAY
event object.
The data that is associated with this event type is "timestamp" which results in the following output string:
PLAY, timestamp
Where timestamp is the video time in milliseconds when the event occurs, if known (real). The event is dispatched when the movie starts playing as a result of user interaction. The event is also dispatched if the video is set to autoplay on load. The event may still be sent by the component if the autoplay was set, but blocked by the web browser.trackEvent
property for a PLAYBACK_COMPLETE
event object.
PLAYBACK_COMPLETE
The event is dispatched when video playback ends.trackEvent
property for a PLAYBACK_ERROR
event object.
The data that is associated with this event type is "error message" which results in the following output string:
PLAYBACK_ERROR, error message
The event is dispatched when error occurs during video playback.trackEvent
property for a RECORD
event object.
RECORD
The event is dispatched when the movie starts recording as a result of user interaction.trackEvent
property for a REPLAY
event object.
REPLAY
The event is dispatched when the user replays the video after video has ended.trackEvent
property for a SOCIAL_SHARING
event object.
The data that is associated with this event type is "mode" which results in the following output string:
SOCIAL_SHARING, mode
Where mode is the way of sharing viewer's content. The event is dispatched when user clicks on social sharing buttons.trackEvent
property for a SPIN
event object.
The data that is associated with this event type is "frameNumber" which results in the following output string:
SPIN, frameNumber
The event is dispatched when spin is triggered on the image.- See:
- s7sdk.set.SpinView
trackEvent
property for a STOP
event object.
The data that is associated with this event type is "timestamp" which results in the following output string:
STOP, timestamp
Where timestamp is the video time in milliseconds when the event occurs, if known (real). The event is dispatched when the playback reaches the end.trackEvent
property for a SUBTITLE_CHANGE
event object.
The data that is associated with this event type is "role, label" which results in the following output string:
SUBTITLE_CHANGE, rolelabel
The event is dispatched when subtitle/caption is changed from audio captions menu.trackEvent
property for a SWAP
event object.
The data that is associated with this event type is "asset" which results in the following output string:
SWAP, 0, asset
Where asset is the newly set asset through user action. The 0 value is a placeholder. This event is dispatched by components that support theasset
modifier when the existing asset value is replaced with
a new one. The event is dispatched when the components setAsset()
API is called with
a new asset value.
- See:
- s7sdk.set.Swatches#setAsset()
- s7sdk.image.ZoomView#setAsset()
- s7sdk.image.FlyoutZoomView#setAsset()
trackEvent
property for a SWATCH
event object.
The data that is associated with this event type is "frame, image label" which results in the following output string:
SWATCH, frame, image label
Where frame is the current frame, and image label is the label that is associated with the asset in the frame. If no label is present, the value is returned empty. The event is dispatched when the user clicks a swatch or mouses over it when in rollover mode.- See:
- s7sdk.set.Swatches
trackEvent
property for a TARG
event object.
The data that is associated with this event type is "id, label, user data" which results in the following output string:
TARG, id, label, user data
Sent by theZoomTargets
component when a user selects a target. The label and user data are empty if they are not
defined for the zoom target.
trackEvent
property for a UN_FULLSCREEN
event object.
The data that is associated with this event type is "width, height" which results in the following output string:
UN_FULLSCREEN, width, height
The event is dispatched when the user exit from fullscreen mode.trackEvent
property for a UNMUTE
event object.
The data that is associated with this event type is "timestamp" which results in the following output string:
UNMUTE, timestamp
Where timestamp is the video time in milliseconds when the event occurs, if known (real). The event is dispatched when the video is unmuted as a result of user interaction.trackEvent
property for a ZOOM
event object.
The data that is associated with this event type is "scale" which results in the following output string:
ZOOM, scale
The event is dispatched when zoom is triggered on the image.UserEvent
object. This string
is in the following format:
type,data
- Returns:
- A string that contains all the properties of the
UserEvent
.