# Track Video Views

There are several helpful patterns for tracking a video.

## Video Progress

While tracking video views it is recommended to send progress events at key portions of the. This will help you understand how much of a video someone has watched. Think of these events as checkpoints.

For example, you can have a Video Start event followed by many Video Playing events. In each of the Video Playing, you should include the current video time and total video time as a property. You can get a percentage viewed by leveraging a custom property.

## Video Actions

If you want a more general idea of how your users are interacting with a video, track an Event for each video state change whether that’s the user selecting to start the video, pause the video, or finish the video.

mixpanel.track(“Video Play Started”, {
“Video title”:”Title”,
“Video completed”: true,
“Video length in seconds”:200
});

mixpanel.track(“Video Paused”,{
“Video title”:”Title”,
“Video completed”: false,
“Video time of pause”:112
});


## Let our SDK time the event

If you are using our JavaScript SDK we have a built-in method that will manage simple time calculation. The time_event() function allows you to start a timer for a given event name. When that event is eventually tracked, the library will include a $duration property to the event. The value of the$duration property is the number of seconds between the time_event() and track() call.

// Example time 5:00:00mixpanel.time_event('Completed Video')// User eventually watches the videoplay_video();// Example time 5:01:20mixpanel.track('Completed Video') // Resulting Event:// {//   event: "Completed Video",//   properties: {//     \$duration: 80,//   },// }

Note that each call to time_event for the same event name restarts the start timer