使用javascript mix-panel API在mix-panel中跟踪onclick视频

时间:2015-12-24 07:54:33

标签: javascript html css mixpanel

我在我的网站上嵌入了视频。视频正在播放点击我想使用mixpanel跟踪视频事件 这是我的HTML代码

<section class="third-section">
  <div style="width:100%">
    <div class="flex-video widescreen" style="margin: 0 auto;text-align:center;">
      <video id="mid_section_video" class="all_videos" preload="auto"  muted=”muted” poster="{% static 'images/wikireviews.jpg' %}">
        {% trans "Your browser does not support the video tag." %}
      </video>                                  
    </div>
  </div>                            
  <div class="vidoe-tag">
    <a href="javascript:void(0);" class="video-btn"></a>
  </div>
</section>

当点击视频我希望使用mixpanel跟踪此事件时,我已经参考了Mixpanel javascript API,我已将Mixpanel代码包含到我的网站中,但它无效。我想在<a href="javascript:void(0);" class="video-btn"></a>这个

上捕捉事件

Js代码嵌入了视频

function addSourceToVideo(element, src, type) {     
        var source = document.createElement('source');
        source.src = src;
        source.type = type;
        element.appendChild(source);
    }
        var video;
        video = document.getElementById('mid_section_video');
        addSourceToVideo(video, STATIC_PATH+"videos/webm/video_011.webm", "video/webm");
        addSourceToVideo(video, STATIC_PATH+"videos/webm/video_011.ogg", "video/ogg");
        addSourceToVideo(video, STATIC_PATH+"videos/mp4/video_011.mp4", "video/mp4");

混合面板代码

<script type="text/javascript">
  mixpanel.track("Video play");
</script>

如何在cilck上跟踪视频

0 个答案:

没有答案