YouTube Video Milestones tracking

Rookie Contributor

I have found only one comperehensive post on YouTube Video Events tracking here:

(Successfully implemented)


The only question that was not fully answered was about YouTube Video Milestones tracking.


Is it possible to get any assistance with the YouTube Video Milestones tracking in Tealium iQ? A couple of code examples will suffice.




YouTube Video Milestones tracking

Employee Emeritus

Hi @alexander_shabe. We are working on getting an answer for you. Thank you for your patience. 

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.

YouTube Video Milestones tracking

Tealium Employee



So after some experimenting here is a code snippet that I got working that would fire a milestone event once, per each milestone.


      var playerCheckInterval;
      var mileStones = [1,2,25,50, 75]
      function onPlayerStateChange(event) {
        if ( == YT.PlayerState.PLAYING) {
          playerCheckInterval = setInterval(mileStoneCheck, 100);          
        } else if ( == YT.PlayerState.PAUSED) {
          //Send PAUSED Event
        } else if ( == YT.PlayerState.ENDED ) {
          //Send ENDED Event
      function mileStoneCheck() {
        var duration = player.getDuration();
        var percComplete = (player.getCurrentTime() / player.getDuration()) * 100;
        var ms_len = mileStones.length;
        if (ms_len > 0) {
          var next_ms = mileStones[0];
          if (next_ms <= percComplete) { 
            console.log("mileStoneCheck", next_ms, percComplete, player.getCurrentTime());  

Hope this helps.



Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.