Depending the display mode you use and the type of player, the tracking to integrate is different.
Display Media
Here no custom tracking needs to be added. The Google Analytics Drupal module with Track download links
enabled does the job.
SoundManager player
If you use any of the available players, you need to add a custom javascript code and add a callback on the play
event which is triggered on the first play of the SoundManager player(s).
The javascript looks as follows:
// Add callback on play event
threeSixtyPlayer.events.play = function() {
var url = this.url, // retrieve URL for active played MP3
file = url.substring(url.lastIndexOf('/')); // only keep filename of MP3
// Push an event to GA
_gaq.push(['_trackEvent', 'mp3', 'play', file.substring(1)]);
}
The event that is pushed to Google Analytics looks like this:
[mp3,play,Maid with the Flaxen Hair.mp3?uuid=525c67793bcd5]
Depending the used player, you should update and use to correct available instance.
SoundManager2 Page Player
pagePlayer.events.play = function() { ...
SoundManager2 UI 360
threeSixtyPlayer.events.play = function() { ...
SoundManager2 Inline player
inlinePlayer.events.play = function() { ...
SoundManager2 MP3 Basic player
basicMP3Player.events.play = function() { ...