piwikTracker.trackGoal does not log my goal

To get the problem more in the picture:

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;
}
?>

Pure HTML-version:

<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>

We can close this thread.
When using the HTML version, it DOES work.
So it is the way the plugin triggers/calls the page.

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)

And make the Piwik code as a function:

<script type="text/javascript">
//<![CDATA[
function logme()
{
try {
 var piwikGoalTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
 piwikGoalTracker.trackGoal(3);
}
catch( err ) {}
}
//]]>
</script>

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…

Virogo, could you please prepare a FAQ answer/tutorial for this? For example “How to track a goal in Piwik from the JW Video Player?”

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 :wink:

[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]

Created a new post with the title you asked.

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