Go
Not registered? Sign up!

Tracking Play Stop events

Google Translate
2 posts | return to the JavaScript Interaction forum | get the rss feed for this thread

Nov. 14, 2009germano

Hi,

I've installed Allvideo reloaded plug in and it works properly. What i need to do is to track video activity with a WebAnalytics application ( Webtrends Analytics). To do this i have to place a call to a js function in the same position of the player calls. In other words i have to pace the following call 'multitrack.Send' inside the play function of the player and a similar one inside the player sto event.

dcsMultiTrack multitrack=new dcsMultiTrack();

multitrack.Send("DCS.dcssip","www.trespot.it/webanalytics","DCS.dcsuri","/video_events/"+stop,"WT.clip_n",mediaName,"WT.clip_ev","Play");


These call are used to send information about start and stop events to the Webanalytics application; in this way i can track the video utilize. Where i can find the proper location where i can put the call? Where is the player code inside Joomla? Is it possible to edit it? At the moment the local video i have are flv.

I found the file .../content/avreloaded/swfobject.js and it seems that without this file the player doesn't work. so i guess that this is the file that i have to edit but i don't find any function like 'play' or 'stop' that instead i found in the file avreloaded-uncompressed.js in the same folder.

Thanks,

Germano

Nov. 15, 2009germano

Thanks,

I solved updating the player at the last version (downloaded by this web site) so the function playerReady is correctly called. After this i have added the following code directly in the template HTML (in joomla):


<!-- START OF Video Tracking -->
<!-- Created: 11/15/2009 By GM -->
<!-- START OF Player Track routine -->
<!-- @author maranog -->
<script type="text/javascript">
var player = null;
var playlist = null;
var currentState = null;


function playerReady(obj)
{
alert('the videoplayer ' +obj['id']+ ' è stato inizializzato');
player = gid(obj.id);
addListeners();
};


function addListeners()
{
playlist = player.getPlaylist();

if((playlist !== null) && (playlist.length > 0))
{
player.addModelListener('STATE', 'stateMonitor');
}
else
{
setTimeout("addListeners();", 100);
}
};


function stateMonitor(obj)
{
currentState = obj.newstate;
previousState = obj.oldstate;
var multitrack=new dcsMultiTrack();

//...do something here based upon the state of the player

if (currentState == "PLAYING") {
multitrack.Send("WT.clip_n", "Tecnologo per caso", "WT.clip_ev", "Play", "WT.dl", "7");
alert('Webtrends: ' + currentState);
}

if (currentState == "BUFFERING") {
multitrack.Send("WT.clip_n", "Tecnologo per caso", "WT.clip_ev", "Buffering", "WT.dl", "7");
alert('Webtrends: ' + currentState);
}


if (currentState == "COMPLETED"){
multitrack.Send("WT.clip_n", "Tecnologo per caso", "WT.clip_ev", "Completed", "WT.dl", "7");
alert('Webtrends: ' + currentState );
}

if (currentState == "IDLE") {
multitrack.Send("WT.clip_n", "Tecnologo per caso", "WT.clip_ev", "Idle", "WT.dl", "7");
alert('Webtrends: ' + currentState );
}

if (currentState == "PAUSED") {
multitrack.Send("WT.clip_n", "Tecnologo per caso", "WT.clip_ev", "Paused", "WT.dl", "7");
alert('Webtrends: ' + currentState );
}

//...only for testing
alert('State: ' + obj.newstate);
};


function gid(name)
{
return document.getElementById(name);
};
</script>

<!-- END -->

Add a reaction

You can also return to the category or try this search for related threads.


 

Search the Forums

Go

Support

Support Here are some helpful links to learn more about the JW Player™:

Monetize Your Video

Monetize Your Video Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!

Why Buy a License?

Why Buy a License? If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.