By default, the viewer sends a single tracking HTTP request to the configured Image Server with the viewer type and version information.
To integrate with third-party analytics systems, it is necessary to listen to the trackEvent
viewer callback and process the eventInfo
argument of the callback function as necessary. The following code is an example of such handler function:
var interactiveVideoViewer = new s7viewers.InteractiveVideoViewer({
"containerId":"s7viewer",
"params":{
"asset":"/content/dam/mac/aodmarketingna/dm-viewers-content/video/Glacier.mp4",
"config":"/etc/dam/presets/viewer/Shoppable_Video_Dark",
"serverurl":"https://aodmarketingna.assetsadobe.com/is/image/",
"videoserverurl":"https://gateway-na.assetsadobe.com/DMGateway/public/aodmarketingna",
"contenturl":"https://aodmarketingna.assetsadobe.com/",
"interactivedata":"is/content/content/dam/mac/aodmarketingna/_VTT/dm-viewers-content/video/Glacier.mp4.svideo.vtt"
},
"handlers":{
"trackEvent":function(objID, compClass, instName, timeStamp, eventInfo) {
//identify event type
var eventType = eventInfo.split(",")[0];
switch (eventType) {
case "LOAD":
//custom event processing code
break;
case "INTERACTIVE_SWATCH":
//custom event processing code which handles user clicks on interactive swatches
break;
//additional cases for other events
}
}
}
});
The viewer tracks the following SDK user events:
SDK user event |
Sent... |
---|---|
LOAD |
when viewer is loaded first. |
SWAP |
when an asset is swapped in the viewer using setAsset() API. |
PLAY |
when playback starts. |
PAUSE |
when playback is paused. |
STOP |
when playback is stopped. |
MILESTONE |
when playback reaches one of the following milestones: 0%, 25%, 50%, 75%, or 100%. |
INTERACTIVE_SWATCH |
each time the user clicks an interactive swatch. |