Adobe DTM和JW Player标记仅迭代第一个视频

时间:2015-05-11 21:25:57

标签: jwplayer adobe-analytics

有人可以向我提供有关如何让这些代码在jw轮播中使用下一个选定视频的帮助吗?

var newVideo = ["video1", "video2", "video3", "video4"];
function trackVideo(){
// video start
jwplayer().onPlay(function(event){
 _satellite.track("videostart");
 console.log("onPlay");
 });
}
trackVideo(newVideo)

1 个答案:

答案 0 :(得分:0)

感谢您的帮助。我扩展了代码并用for循环纠正了它,它完美地运行。原始代码来自here

我需要稍微修改它以使用jwplayer播放列表而不是单个视频(全部使用adobe DTM:排除实际标签,我使用cosnole.log返回值)...谢谢,这里是..

//
var newVideo = ["video1", "video2", "video3", "video4", "video5", "video6", "video7", "video8"];
function trackVideo(a){
for(var i = 0, l = a.length; i < l; i++){
// video start
jwplayer(a[i]).onPlay(function(event){
  _satellite.track("videostart");
 console.log("onPlay");
 });
// video stop, pause
 jwplayer(a[i]).onPause(function(event){
  _satellite.track("videopause");
 console.log("onPause");
 });
 // video complete
 jwplayer(a[i]).onComplete(function(event){
  _satellite.track("videocomplete");
 console.log("onComplete");
 });
  // video timer fires the direct call rule halfway through the video
 jwplayer(a[i]).onTime(function(event) {
 if (event.position == parseInt(jwplayer().getDuration()/2)) {
 _satellite.track("videofiftypercent");
 console.log("onTime");
 }
 });
   // video timer fires the direct call rule quarter through the video
 jwplayer(a[i]).onTime(function(event) {
 if (event.position == parseInt(jwplayer().getDuration()/4)) {
 _satellite.track("videotwentyfivepercent");
 console.log("onTimeTwentyFive");
 }
 });
}
}
trackVideo(newVideo);