I am using a callback.php which is triggered by a Flash plugin for the JWPlayer.
It posts data with 2 fields: state & file.
I want to trigger a goal to be logged, but did not succeed so far.
I even tried to make a clean html-page with the things needed to log a goal.
When using the URL match construction in the Goal-plugin from Piwik, it does work when visiting that page using the browser.
However, calling a URL from within Flash does not work. So I tried using the piwikTracker.trackGoal
What could be going wrong?
Here you see both scripts.
callback.php:
<?
if ($_POST['state'] == "COMPLETE(33%)") //Sent by the Flash plugin
{
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;
}
?>
If you are using a Flash videoplayer called JWPlayer and want to track if your video is being watched:
Create a goal
Check the goalID
Use the JWPlayer and Madlytics plugin
Set the callbacktype as javascript
Set the callbacklistener to your function (logme for instance)
This is a working situation for me.
If needed I can provide you the full example…
Any previous thread (and the stuff above) is my stupid oversight…
Cause the callback script above needs to be rendered clientside in order to perform its javascript code.
And is Flash a browser? No. So it does not render the page and thereby will not activate any clientside code…
After my holiday, I will make a nice tutorial how to set a goal and how to link this with JWPlayer playing a video using the Madlytics plugin!
For now, I am enjoying the morning sun at 500m from the beach
[quote=virogo @ Jul 24 2009, 08:34 AM]After my holiday, I will make a nice tutorial how to set a goal and how to link this with JWPlayer playing a video using the Madlytics plugin!
For now, I am enjoying the morning sun at 500m from the beach ;-)[/quote]
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