Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track the vidoe websites #10786

Closed
gkannan21 opened this issue Oct 25, 2016 · 2 comments
Closed

Track the vidoe websites #10786

gkannan21 opened this issue Oct 25, 2016 · 2 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@gkannan21
Copy link

Hi,
iam new to piwik, we have video sharing site like youtube, i need to track those videos from piwik.
How to do that,any plugins available, orelse how to do that.
my requirements is ,
1.need to track each and every videos.
2.who played that videos
3.track the play,pause,skip click also
4.how many times and minutes watch the video

Please help me to solve this issue.
Thanks
KannanG

@fvdm
Copy link

fvdm commented Oct 26, 2016

3.track the play,pause,skip click also
4.how many times and minutes watch the video

You can send events to Piwik for YouTube player events.

https://developers.google.com/youtube/iframe_api_reference#Getting_Started
https://piwik.org/docs/event-tracking/

Something like this:

var player;

function videoStateChange (event) {
  var state;
  var videoId = player.getVideoData()['video_id'];
  var seconds = Math.round (player.getCurrentTime());

  switch (event.data) {
    case -1: state = 'Unstarted'; break;
    case 0: state = 'Ended'; break;
    case 1: state = 'Playing'; break;
    case 2: state = 'Paused'; break;
    case 3: state = 'Buffering'; break;
    case 4: state = 'Cued'; break;
  }

  // Replace `console.log` with `_paq.push` to actually send to Piwik
  if (state === 'Paused') {      
    console.log (['trackEvent', 'Video', state, videoId, seconds]);
  } else {
    console.log (['trackEvent', 'Video', state, videoId]);
  }
}

function onYouTubeIframeAPIReady() {
  player = new YT.Player ('player', {
    height: '390',
    width: '640',
    videoId: 'M7lc1UVf-VE',
    events: {
      'onStateChange': videoStateChange
    }
  });
}

Edit:
I uploaded a demo here: https://frankl.in/demo/piwik/10786-youtube.htm
Watch the debug console while playing and pausing.

@tsteur
Copy link
Member

tsteur commented Oct 26, 2016

@gkannan21 have a look at http://www.media-analytics.net/ . It is very feature rich and gives lots of insights into video (and audio) analytics. A full list of features is mentioned on our Marketplace https://plugins.piwik.org/MediaAnalytics . The points you mentioned will be fulfilled by that plugin.

@tsteur tsteur closed this as completed Oct 26, 2016
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants