Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Having Trouble getting Your Analytics set up

6 replies [Last post]

Hello, everyone

I set up my database table and modified the php on my site to include database name, username, password etc.

I also altered the flashvars to callback to my php page.

On my php page (which I assume is where the analytics data is supposed to be) all I get is "result=failure"

Can anyone help me out?

Player code for v4.4.174 JW FLV Media Player (swfobject v2.2):

  'plugins':              'http://www.domain.com/path/yourlytics-1',
  'yourlytics.callback':  'http://www.domain.com/path/callback.php?player=test.html',  // sends player as _GET, sends file & state as _POST
//'yourlytics.callback':  'http://www.domain.com/path/callback.php',                   // sends file & state

callback.php

<?php

// for testing, call with: http://www.domain.com/path/callback.php?file=filename.flv&title=Video Title&id=7h836&state=start&duration=30&author=Author's Name&description=Descriptive Text goes Here&userid=123456789

// this is the filename for the log file
$filename = 'callback.log';

//////////////////////// End of user configurable variables ////////////////////////////

extract($_GET, EXTR_PREFIX_SAME, "get_");
extract($_POST, EXTR_PREFIX_SAME, "post_");

//...debug
/*
print "<pre>\n";
print "       File: " . $file        . "\n";
print "      Title: " . $title       . "\n";
print "         ID: " . $id          . "\n";
print "      State: " . $state       . "\n";
print "   Duration: " . $duration    . "\n";
print "     Author: " . $author      . "\n";
print "Description: " . $description . "\n";
print "    user ID: " . $userid      . "\n";
print "     player: " . $player      . "\n";
print "</pre>";
exit;
*/
//...debug

// check to see if $filename exists, if not, create it.
touch($filename) or die("Unable to create: " . $filename);

// log file format: [01/Apr/2007:00:01:40 -0700]
$datetime = "[" . date('d/M/Y:h:i:s O') . "]";

$somecontent = $_SERVER[REMOTE_ADDR] . " - - " . $datetime . " \"" . $player . " : " . $file . " : " . $state . "\" - \"-\" \"" . $_SERVER[HTTP_USER_AGENT] . "\"\r\n";

$handle = fopen($filename, 'a') or die("Could not open file: " . $filename . "\n");

// Write $somecontent to the open file.
fwrite($handle, $somecontent) or die("Could not write to file: " . $filename . "\n");

//...debug
/*
fwrite($handle, "_POST:\r\n");
foreach($_POST as $k=>$v)
{
  fwrite($handle, $k . "=" . $v . "\r\n");
}
fwrite($handle, "_GET:\r\n");
foreach($_GET as $k=>$v)
{
  fwrite($handle, $k . "=" . $v . "\r\n");
}
*/
//...debug

fclose($handle);

?>

I am having the exact same problem as Nikc.

All of my database information is CORRECT... using mySQL 5.0. I set up the database EXACTLY like the DOC file from below said:
http://www.longtailvideo.com/AddOns/documentation/44/YourAnalytics.zip

I tried calling in the plugin with:
plugins=yourlytics_1&yourlytics.callback=http://www.yourdomain.com/jw_callback.php

AND like:
&plugins=yourlytics-1&yourlytics.callback=http://www.yoursite.com/jw_callback.php

Nothing in the database changed after watching, pausing, and fast forwarding a video.

Additionally, when I simply call up the file by typing "http://www.yoursite.com/callback.php", I get "result=failure".

What is going on? If I knew where to look for the error, I could figure it out.

I tried the suggestion REVVER made... and it WORKED. But, I want this stuff to be recorded into a database so I can call on the information.

BUT REALLY, all I want is a way to count how many times a video has been played AND display that number on the page with the video (or on the video...do not care where it is). That is it...but that just seems to be an impossible task! (I tried Count Trackula... but there is not enough documentation available to know what I am doing... AND I tried SimpleStats, but NONE of the versions are available for download--all return with 404 pages.) Please Help! I am out of options. (P.S> I am not a programmer...I just muddle through until I figure stuff out.)

Below is the jw_callback.php file I am using (minus the database info):

<?php

# login data for the database
$settings['database_user'] = 'XXXXX';
$settings['database_pwd'] = 'password';
$settings['database_host'] = 'XXXXX.secureserver.net';
$settings['database_database'] = XXXXX';

$mysql = @mysql_connect( $settings['

database_host'] , $settings['database_user'] , $settings['database_pwd'] )  or die(mysql_error());
@mysql_select_db ( $settings['
database_database'] ) or die(mysql_error());

if (isset($_POST['

file']) && $_POST['state']) {
        $sql = "SELECT * FROM jw_callback WHERE filename = '".$_POST['file']."' LIMIT 1";
        $result = mysql_query($sql);

        if(mysql_num_rows($result) > 0){
                while ($row = mysql_fetch_array($result, MYSQL_ASSOC))  {
                        if ($_POST['

state'] == "play") {
                                $sql="UPDATE jw_callback set played=".($row['
played'] + 1)." WHERE filename='".$_POST['file']."'";
                                mysql_query($sql);
                        } elseif($_POST['
state'] == "completed") {
                                $sql="UPDATE jw_callback set completed=".($row['
completed'] + 1)." WHERE filename='".$_POST['file']."'";
                                mysql_query($sql);
                        } elseif($_POST['
state'] == "paused") {
                                $sql="UPDATE jw_callback set paused=".($row['
paused'] + 1)." WHERE filename='".$_POST['file']."'";
                                mysql_query($sql);
                        }
                }
        } else {
                if ($_POST['
state'] == "play") {
                        $sql="INSERT INTO jw_callback set played=1, filename='".$_POST['file']."'";
                        mysql_query($sql);
                } elseif($_POST['
state'] == "completed") {
                        $sql="INSERT INTO jw_callback set completed=1, filename='".$_POST['file']."'";
                        mysql_query($sql);
                } elseif($_POST['
state'] == "paused") {
                        $sql="INSERT INTO jw_callback set paused=1, filename='".$_POST['file']."";
                        mysql_query($sql);
                }
        }
echo "
result=success";
} else {
echo "
result=failure";
}
?>

I want to use Your Analytics within a .Net environment and can't seem to get it to work. I am using the latest JW Player (v4.5) and the swobject.js that comes with it.
The player plays but does not call the .Net aspx page.

My first questions is has its callback called a .Net website to post its variables as opposed to a php script?

I have tried the following two code snippits to test and neither one works. Note that "http://localhost:1505/PutFMSStats.aspx" is a .Net test site under development with VS2005 that will accept, extract and save the POST variables "file" and "state". I have tested its operation to be ok with another .Net app that submits the posted variables to it.

so.addParam('flashvars','file=Test/test.flv&streamer=rtmp://flash.delmar.cengage.com/DLvideo&plugins=yourlytics-1&yourlytics.callback=http://localhost:1505/PutFMSStats.aspx');
so.addParam('flashvars','file=Test/test.flv&streamer=rtmp://flash.delmar.cengage.com/DLvideo&plugins=http://plugins.longtailvideo.com/yourlytics-1.swf&yourlytics.callback=http://localhost:1505/PutFMSStats.aspx');

It could be a problem with Flash cross-domain security restrictions where the domain that you serve the Flash movie from is not the same as the domain (localhost:1505) that you are trying to access with the callback.

Try putting a cross-domain policy file on the root of locahost.

Both the calling app (my tester) that hosts the player and the serving application (PutFMSStats.aspx) reside on localhost so I thisk that it will buy me anything. But I will try this as soon as I can and get back to you.

Thanks,

-Tom

 
Be aware that:

http://localhost:80/    (or whatever port you are using)
and
http://localhost:1505/

are NOT the [i]EXACT[/i] same domain for Flash security.

See:

    http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Part...

and many other articles on Adobe's site on same-domain security restrictions.

    http://www.google.com/search?hl=en&source=hp&q=site%3Aadobe.com+same+domain+security&aq=f&oq=&aqi=