2 require_once("./JSON.php");
4 $filename = "./logs/analytics.log";
5 $json = new Services_JSON;
8 $items = $json->decode($_REQUEST["data"]);
10 if (!$handle = fopen($filename, 'a+')) {
11 print '{error: "server error"}';
15 foreach($items as $i=>$item){
16 $item->_analyticsId = $id;
17 $item->_analyticsTimeStamp = time();
18 $log = $json->encode($item) . "\n";
19 fwrite($handle, $log);
24 $response = "{'eventsRecieved': '" . sizeof($items) . "', 'id': '" . $id . "'}";
25 if ($_REQUEST["callback"]){
26 print $_REQUEST["callback"] . "(" . $response . ");";