Track minutes listened of Audio Files | XM Community
Skip to main content

I created a survey with an audio file that I uploaded into one of the survey questions. I need to track if the participant started the audio file and into the amount of minutes they listened to this audio file. I've seen posts about using HTML or JavaScript code to track this in embedded data. I'm not sure how to create code for this. Can anyone assist? I would appreciate any help someone could offer.
Larisa Burke

The complexity of the code will depend upon how reliable your participants are. If you trust them, then all you need to do is to look at

played. start(0)
and
played.end(0)
. This will give you the time range for audio/video the first time it was played.
If you think they'll skip ahead and listed to only parts of it. You can use the played attribute to see how many time they stopped/paused.
element.played
will return the number of times they did this. You can then iterate over
start 
and
end 
to figure out whether they listened to entire clip or not.


Hi Ahmed,
Thank you so much for responding to my question. I'm very new to Javascript. Can you give an example code for using played.start(0) and played.end(0) and element.played so I can see how you would set up.
Thank you so much for your help. I really appreciate it!
Larisa


Leave a Reply