Getting stats (set goal) on JWPlayer

I use JWPlayer Longtailvideo[/url] to play my video’s. And with the Madlytics plugin [url=http://www.longtailvideo.com/AddOns/get-instructions.html?addon=108&q=]found here you could eventually get results in Piwik when someone played your video and it reached e.g. 50%.

But it realy confuses me how to trigger such a thing.
I can either trigger a certain URL with this plugin, or trigger a Javascript function.

But the javascript explanation on Piwik makes me doubt a few things.
Like: I can use piwikTracker.trackGoal(1); // logs a conversion for goal 1

But okay, will I see “1” in my logs? Or will I see the parsed data from the JW-plugin or what?
I realy do need such a reference to figure out how my video’s are watched…

EDIT: Or even more simple, can I make it count as a download in such a way? THat would be good enough.

[quote=virogo @ Jul 7 2009, 05:07 PM]I use JWPlayer Longtailvideo[/url] to play my video’s. And with the Madlytics plugin [url=http://www.longtailvideo.com/AddOns/get-instructions.html?addon=108&q=]found here you could eventually get results in Piwik when someone played your video and it reached e.g. 50%.

But it realy confuses me how to trigger such a thing.
I can either trigger a certain URL with this plugin, or trigger a Javascript function.

But the javascript explanation on Piwik makes me doubt a few things.
Like: I can use piwikTracker.trackGoal(1); // logs a conversion for goal 1

But okay, will I see “1” in my logs? Or will I see the parsed data from the JW-plugin or what?
I realy do need such a reference to figure out how my video’s are watched…

EDIT: Or even more simple, can I make it count as a download in such a way? THat would be good enough.[/quote]

Tracking a goal will give you the Goal Report, for example “Download Piwik” goal on piwik.org: http://piwik.org/demo/index.php?module=Cor…ay&idGoal=1

Currently the goal plugin doesn’t give the reports “Conversions per landing page” but this is in the feature request list, see: http://dev.piwik.org/trac/browser/trunk/pl…e_notes.tpl#L10

Concerning triggering Piwik from flash, I believe there are some users doing something similar, but I am not sure how it technically work? Did you make it work?

I believe I have the plugin on the JWPlayer active.
Now I can either activate some javascript function on my page (which should then do something to trigger Piwik) or I could do a postback to a url.

Now only the trick is, what to do to get Piwik count at least something.
I think the javascript-function would be the easiest way as I think there is more detailed info to postback to Piwik on that way.

Well, maybe some day…

EDIT:
Hmmm, if such a goal is being triggered URL based? How to set a goal in Piwik? And if I would trigger such a url, then it would basicly log what I need. People visited the page, clicked on the Flash video player and the JWPlayer plugin would trigger at 50% played video. So then I would count in my goal that people have seen the video.

Still to find out: How to setup a goal and how to trigger it.

Please enabled the Goals plugin, it is still alpha hence why we hide it

Found it and got it working.
Now its up to the developers of JWPlayer plugins to get it working for the player too.
Hence it posts data to a given URL as callback, but that does not trigger the Goal.
When just plain entering the url into the browser for instance, does do the trick.
Trying to get the plugin maker to make an option to send a GET instead of POST, which eventually should make it work.

You should be able to use GET. The problem is more likely in the encoding of the URL (e.g., ampersands).

Nah, that’s for the plugin for JWPlayer to perform, but never mind that…
I have been very stupid as always…

Yet I am very close in succeeding what I want.
I made me own callback.php with just a bit of simple code.

But it does not trigger my goal, maybe if you can help me out here, it will work!

<?
if ($_POST['state'] == "COMPLETE(33%)")
{
?>

<HTML>
<HEAD>
</HEAD>
<BODY>
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mydedicatedpiwikserver.com/piwik/" : "http://mydedicatedpiwikserver.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
piwikTracker.trackGoal('video2'); // logs a conversion for goal 1
piwikTracker.trackPageView();
//piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<!-- End Piwik Tag -->
</BODY>
</HTML>

<?
@mail("webmaster@mywebsite.nl","CALLBACK PIWIK TRIGGERED","Callback triggered\n\n" . $_POST['state'] . "\n\n" . $_POST['file'] . "\n\n","From: website@mywebsite.nl\r\n");
}
else
@mail("webmaster@mywebsite.nl","CALLBACK NO TRIGGER","Callback triggered\n\n" . $_POST['state'] . "\n\n" . $_POST['file'] . "\n\n","From: website@mywebsite.nl\r\n");
?>

As you can see in the code, I used the API code to trigger the goal manually:

piwikTracker.trackGoal('video2'); // logs a conversion for goal 1

But it does not yet count in piwik. Even when using (video2) without the quotes.

The mails are sent as a reference, and I get emails when the player starts, ends and when it is playing 33%, it will place the html part to get the piwik code activated trying to set the goal manually.

Anything missing here?
I skipped piwikTracker.enableLinkTracking on purpose as it is not needed I guess?

Eventually I see that it needs the Goal-ID…
So I set it to be piwikTracker.trackGoal(2)
But still not being triggered.
Tried from different IP’s and PC’s to be sure it is a unique visit.


After reading @dev.piwik.org:
(In [1214]) refs #778 adding the new Javascript Tracking API function: trackGoal to manually trigger a goal. Example usage: piwikTracker.trackGoal(idgoal, [customRevenue], [customData]);

This can be used on external websites, simply give them the Piwik JS tracking tag, remove trackPageView and enableLinkTracking, and add the trackGoal call.

Marc, please let us know if you need more details to write the tutorial/documentation.

New code, still not logged goal #2

callback.php:

<?
if ($_POST['state'] == "COMPLETE(33%)")
{
    echo <<<PiwikTrackerCode

<HTML>
<HEAD>
</HEAD>
<BODY>
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mediaserver01.virogo.com/piwik/" : "http://mediaserver01.virogo.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
piwikTracker.trackGoal(2);
} catch( err ) {}
</script>
<!-- End Piwik Tag -->
</BODY>
</HTML>

PiwikTrackerCode;
}
?>

Even a better test:

callback.html:

<HTML>
<HEAD>
</HEAD>
<BODY>
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://mydedicatedpiwikserver.com/piwik/" : "http://mydedicatedpiwikserver.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
piwikTracker.trackGoal(2);
} catch( err ) {}
</script>
<!-- End Piwik Tag -->
</BODY>
</HTML>

Even when opening this html-page in a browser does NOT trigger a goal.
???

Close the thread.
It does work, standalone.
However, the JWPlayer plugin seems to trigger the page in a different way so that it is not seen?..

We now have a Media Analytics plugin that tracks Videos & Audio!

More information is available here: http://www.media-analytics.net/ The plugin gives useful insights into media / video / audio analytics and adds many new reports, widgets and segments to Piwik.

Works with HTML5 video & audio, Vimeo and YouTube out of the box. Support for other players can be added easily and is documented in the developer docs. We are also happy to add support for more players upon request, please ping us. After installation the plugin will in most cases directly start tracking data see the setup guide

For a full list of features check out https://plugins.piwik.org/MediaAnalytics . Docs are available at FAQ, User Guide, Developer docs