添加 Piwik 到代码库中。

+YUCHENG HU+

git-svn-id: https://svn.code.sf.net/p/hawebs/svn@418 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-07-09 19:08:18 +00:00
parent aec1012804
commit 3bb896e752
6 changed files with 218 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>HAWEBS-piwik</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
+2
View File
@@ -0,0 +1,2 @@
# GNU/GPL v3 or later
see misc/license.txt
+59
View File
@@ -0,0 +1,59 @@
Piwik - piwik.org
Description
===========
Piwik is an open source web analytics software.
It gives interesting reports on your website visitors, your popular pages,
the search engines keywords they used, the language they speak… and so much more.
Piwik aims to be an open source alternative to Google Analytics.
Mission statement
=================
« To create, as a community, the leading international open source
web analytics application, providing access to all functionality
through open components and open APIs. »
License
=======
Piwik is released under the GPL v3 license, see misc/license.txt
Requirements
============
- php 5.1.3 or greater
- mysql 4.1 or greater, mysqli or PDO library must be enabled
- OS / server independant
See http://piwik.org/docs/requirements/
Install
=======
- Upload piwik in your webserver
- Point your browser to the directory
- Follow the steps
- Add the given javascript code to your pages
See http://piwik.org/docs/installation/
Changelog
=========
See http://piwik.org/changelog/
API
===
All the data is available via APIs for example to get todays keywords in XML
?module=API&method=Referers.getKeywords&idSite=1&period=month&date=today&format=xml
or yesterday visits information in JSON
?module=API&method=VisitsSummary.get&idSite=1&period=month&date=yesterday&format=json
Check the full documentation on http://dev.piwik.org/trac/wiki/API/Reference
Generate fake data
==================
To generate thousands of fake visits to get some data to play with,
you can see the script /misc/generateVisits.php
you can edit the number of visits to generate, the number of actions per visit, and the days
Contact
=======
http://piwik.org
hello@piwik.org
+60
View File
@@ -0,0 +1,60 @@
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id: index.php 2121 2010-04-25 14:00:36Z vipsoft $
*
* @package Piwik
*/
if(file_exists('bootstrap.php'))
{
require_once 'bootstrap.php';
}
error_reporting(E_ALL|E_NOTICE);
if(!defined('PIWIK_DISPLAY_ERRORS') || PIWIK_DISPLAY_ERRORS)
{
@ini_set('display_errors', 1);
}
@ini_set('magic_quotes_runtime', 0);
define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__)=='/'?'':dirname(__FILE__));
if(!defined('PIWIK_USER_PATH'))
{
define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
}
if(!defined('PIWIK_INCLUDE_PATH'))
{
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
}
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
// NOTE: the code above this comment must be PHP4 compatible
session_cache_limiter('nocache');
@date_default_timezone_set('UTC');
require_once PIWIK_INCLUDE_PATH .'/core/Loader.php';
if(!defined('PIWIK_ENABLE_SESSION_START') || PIWIK_ENABLE_SESSION_START)
{
Piwik_Session::start();
}
if(!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER)
{
require_once PIWIK_INCLUDE_PATH .'/core/ErrorHandler.php';
require_once PIWIK_INCLUDE_PATH .'/core/ExceptionHandler.php';
set_error_handler('Piwik_ErrorHandler');
set_exception_handler('Piwik_ExceptionHandler');
}
if(!defined('PIWIK_ENABLE_DISPATCH') || PIWIK_ENABLE_DISPATCH)
{
$controller = Piwik_FrontController::getInstance();
$controller->init();
$controller->dispatch();
}
+15
View File
@@ -0,0 +1,15 @@
/*
* Piwik - Web Analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id: piwik.js 1931 2010-03-18 06:51:50Z matt $
*/
var Piwik,piwik_log,piwik_track;if(!this.Piwik){Piwik=(function(){var b,f={},d=document,c=navigator,g=screen,l=window,i=l.location.hostname,h=false,o=[];function n(q){return typeof q!=="undefined"}function e(t,s,r,q){if(t.addEventListener){t.addEventListener(s,r,q);return true}else{if(t.attachEvent){return t.attachEvent("on"+s,r)}}t["on"+s]=r}function k(r,u){var q="",t,s;for(t in f){s=f[t][r];if(typeof s==="function"){q+=s(u)}}return q}function m(q){if(n(b)){var r;do{r=new Date()}while(r.getTime()<b)}k("unload")}function p(r){if(!h){h=true;k("load");for(var q=0;q<o.length;q++){o[q]()}}return true}function a(){if(d.addEventListener){e(d,"DOMContentLoaded",function(){d.removeEventListener("DOMContentLoaded",arguments.callee,false);p()})}else{if(d.attachEvent){d.attachEvent("onreadystatechange",function(){if(d.readyState==="complete"){d.detachEvent("onreadystatechange",arguments.callee);
p()}});if(d.documentElement.doScroll&&l==l.top){(function(){if(h){return}try{d.documentElement.doScroll("left")}catch(q){setTimeout(arguments.callee,0);return}p()}())}}}e(l,"load",p,false)}function j(Q,P){var D=Q||"",aa=P||"",V,Z=d.title,G="7z|aac|arc|arj|asf|asx|avi|bin|csv|deb|dmg|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt|qtm?|ra(m|r)?|rpm|sea|sit|tar|t?bz2?|tgz|torrent|txt|wav|wma|wmv|wpd||xls|xml|z|zip",R=[i],u=[],S=[],T=[],C=500,O,y="0",w,B={pdf:["pdf","application/pdf","0"],quicktime:["qt","video/quicktime","0"],realplayer:["realp","audio/x-pn-realaudio-plugin","0"],wma:["wma","application/x-mplayer2","0"],director:["dir","application/x-director","0"],flash:["fla","application/x-shockwave-flash","0"],java:["java","application/x-java-vm","0"],gears:["gears","application/x-googlegears","0"],silverlight:["ag","application/x-silverlight","0"]},K=false,s=l.encodeURIComponent||escape,X=l.decodeURIComponent||unescape,ab=function(ae){var ah=new RegExp('[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]',"g"),af={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};
function ac(ai){ah.lastIndex=0;return ah.test(ai)?'"'+ai.replace(ah,function(aj){var ak=af[aj];return typeof ak==="string"?ak:"\\u"+("0000"+aj.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+ai+'"'}function ad(ai){return ai<10?"0"+ai:ai}function ag(an,am){var al,ak,aj,ai,ao=am[an];if(ao===null){return"null"}if(ao&&typeof ao==="object"&&typeof ao.toJSON==="function"){ao=ao.toJSON(an)}switch(typeof ao){case"string":return ac(ao);case"number":return isFinite(ao)?String(ao):"null";case"boolean":case"null":return String(ao);case"object":ai=[];if(ao instanceof Array){for(al=0;al<ao.length;al++){ai[al]=ag(al,ao)||"null"}aj=ai.length===0?"[]":"["+ai.join(",")+"]";return aj}if(ao instanceof Date){return ac(ao.getUTCFullYear()+"-"+ad(ao.getUTCMonth()+1)+"-"+ad(ao.getUTCDate())+"T"+ad(ao.getUTCHours())+":"+ad(ao.getUTCMinutes())+":"+ad(ao.getUTCSeconds())+"Z")}for(ak in ao){aj=ag(ak,ao);if(aj){ai[ai.length]=ac(ak)+":"+aj}}aj=ai.length===0?"{}":"{"+ai.join(",")+"}";return aj}}return ag("",{"":ae})},v={};
function z(ai,af,ad,ah,ae,ag){var ac;if(ad){ac=new Date();ac.setTime(ac.getTime()+ad*86400000)}d.cookie=ai+"="+s(af)+(ad?";expires="+ac.toGMTString():"")+";path="+(ah?ah:"/")+(ae?";domain="+ae:"")+(ag?";secure":"")}function t(ae){var ac=new RegExp("(^|;)[ ]*"+ae+"=([^;]*)"),ad=ac.exec(d.cookie);return ad?X(ad[2]):0}function q(ae,ad){var ac=new Date(),af=new Image(1,1);b=ac.getTime()+ad;af.onLoad=function(){};af.src=ae}function A(){var ac,ad;if(typeof c.javaEnabled!=="undefined"&&c.javaEnabled()){B.java[2]="1"}if(typeof l.GearsFactory==="function"){B.gears[2]="1"}if(c.mimeTypes&&c.mimeTypes.length){for(ac in B){ad=c.mimeTypes[B[ac][1]];if(ad&&ad.enabledPlugin){B[ac][2]="1"}}}}function I(){var ac="";try{ac=top.document.referrer}catch(ae){if(parent){try{ac=parent.document.referrer}catch(ad){ac=""}}}if(ac===""){ac=d.referrer}return ac}function N(){var ac="_pk_testcookie";if(!n(c.cookieEnabled)){z(ac,"1");return t(ac)=="1"?"1":"0"}return c.cookieEnabled?"1":"0"}function H(){var ad,ac,ae;ac=new Date();
ae="idsite="+aa+"&rec=1&url="+s(n(V)?V:d.location.href)+"&res="+g.width+"x"+g.height+"&h="+ac.getHours()+"&m="+ac.getMinutes()+"&s="+ac.getSeconds()+"&cookie="+y+"&urlref="+s(w)+"&rand="+Math.random();for(ad in B){ae+="&"+B[ad][0]+"="+B[ad][2]}ae=D+"?"+ae;return ae}function r(ad){var ac=H();ac+="&action_name="+s(n(ad)?ad:Z);if(n(O)){ac+="&data="+s(ab(O))}ac+=k("log");q(ac,C)}function W(ac,af,ae){var ad=H();ad+="&idgoal="+ac;if(n(af)&&af!==null){ad+="&revenue="+af}if(n(ae)){if(ae!==null){ad+="&data="+s(ab(ae))}}else{if(n(O)){ad+="&data="+s(ab(O))}}ad+=k("goal");q(ad,C)}function F(ad,ac,af){var ae;ae="idsite="+aa+"&rec=1&"+ac+"="+s(ad)+"&rand="+Math.random()+"&redirect=0";if(n(af)){if(af!==null){ae+="&data="+s(ab(af))}}else{if(n(O)){ae+="&data="+s(ab(O))}}ae+=k("click");ae=D+"?"+ae;q(ae,C)}function L(af){var ad,ac,ae;for(ad=0;ad<R.length;ad++){ac=R[ad];if(af==ac){return true}if(ac.substr(0,2)=="*."){if((af)==ac.substr(2)){return true}ae=af.length-ac.length+1;if((ae>0)&&(af.substr(ae)==ac.substr(1))){return true
}}}return false}function M(ae,ad){var af,ac="(^| )(piwik[_-]"+ad;if(n(ae)){for(af=0;af<ae.length;af++){ac+="|"+ae[af]}}ac+=")( |$)";return new RegExp(ac)}function Y(af,ac,ag){if(!ag){return"link"}var ae=M(S,"download"),ad=M(T,"link"),ah=new RegExp("\\.("+G+")([?&#]|$)","i");return ad.test(af)?"link":(ae.test(af)||ah.test(ac)?"download":0)}function E(aj){var ad,ai,ak,ac;if(!n(aj)){aj=l.event}if(n(aj.target)){ad=aj.target}else{if(n(aj.srcElement)){ad=aj.srcElement}else{return}}while((ai=ad.parentNode)&&((ak=ad.tagName)!="A"&&ak!="AREA")){ad=ai}if(n(ad.href)){var ah=ad.hostname,af=ah.toLowerCase(),ae=ad.href.replace(ah,af),ag=new RegExp("^(javascript|vbscript|jscript|mocha|livescript|ecmascript): *","i");if(!ag.test(ae)){ac=Y(ad.className,ae,L(af));if(ac){F(ae,ac)}}}}function U(ac){e(ac,"click",E,false)}function J(){if(!K){K=true;var ad,ac=M(u,"ignore"),ae=d.links;if(ae){for(ad=0;ad<ae.length;ad++){if(!ac.test(ae[ad].className)){U(ae[ad])}}}}}function x(ad,ac){var ae=null;if(typeof ad=="string"&&!n(v[ad])){if(typeof ac=="object"){ae=ac
}else{if(typeof ac=="string"){try{eval("hookObj ="+ac)}catch(af){}}}v[ad]=ae}return ae}w=I();y=N();A();k("run",x);return{hook:v,getHook:function(ac){return v[ac]},setTrackerUrl:function(ac){if(n(ac)){D=ac}},setSiteId:function(ac){if(n(ac)){aa=ac}},setCustomData:function(ac){if(n(ac)){O=ac}},setLinkTrackingTimer:function(ac){if(n(ac)){C=ac}},setDownloadExtensions:function(ac){if(n(ac)){G=ac}},addDownloadExtensions:function(ac){if(n(ac)){G+="|"+ac}},setDomains:function(ac){if(typeof ac=="object"&&ac instanceof Array){R=ac;R[R.length]=i}else{if(typeof ac=="string"){R=[ac,i]}}},setIgnoreClasses:function(ac){if(typeof ac=="object"&&ac instanceof Array){u=ac}else{if(typeof ac=="string"){u=[ac]}}},setCustomUrl:function(ac){if(n(ac)){V=ac}},setDocumentTitle:function(ac){if(n(ac)){Z=ac}},setDownloadClasses:function(ac){if(typeof ac=="object"&&ac instanceof Array){S=ac}else{if(typeof ac=="string"){S=[ac]}}},setDownloadClass:function(ac){if(typeof ac=="string"){S=[ac]}},setLinkClasses:function(ac){if(typeof ac=="object"&&ac instanceof Array){T=ac
}else{if(typeof ac=="string"){T=[ac]}}},setLinkClass:function(ac){if(typeof ac=="string"){T=[ac]}},addListener:function(ac){if(n(ac)){U(ac)}},enableLinkTracking:function(){if(h){J()}else{o[o.length]=function(){J()}}},trackGoal:function(ac,ae,ad){W(ac,ae,ad)},trackLink:function(ad,ac,ae){F(ad,ac,ae)},trackPageView:function(ac){r(ac)}}}e(l,"beforeunload",m,false);a();return{addPlugin:function(q,r){f[q]=r},getTracker:function(q,r){return new j(q,r)}}}());piwik_log=function(b,e,c,f){function a(g){try{return eval("piwik_"+g)}catch(h){}return}var d=Piwik.getTracker(c,e);d.setDocumentTitle(b);d.setCustomData(f);d.setLinkTrackingTimer(a("tracker_pause"));d.setDownloadExtensions(a("download_extensions"));d.setDomains(a("hosts_alias"));d.setIgnoreClasses(a("ignore_classes"));d.trackPageView();if(a("install_tracker")!==false){piwik_track=function(h,j,i,g){d.setSiteId(j);d.setTrackerUrl(i);d.trackLink(h,g)};d.enableLinkTracking()}}};
+71
View File
@@ -0,0 +1,71 @@
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id: piwik.php 2118 2010-04-24 06:02:35Z vipsoft $
*
* @package Piwik
*/
if(file_exists('bootstrap.php'))
{
require_once 'bootstrap.php';
}
$GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
$GLOBALS['PIWIK_TRACKER_MODE'] = true;
define('PIWIK_ENABLE_TRACKING', true);
error_reporting(E_ALL|E_NOTICE);
define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__)=='/'?'':dirname(__FILE__));
if(!defined('PIWIK_USER_PATH'))
{
define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT);
}
if(!defined('PIWIK_INCLUDE_PATH'))
{
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
}
@ignore_user_abort(true);
require_once PIWIK_INCLUDE_PATH .'/libs/upgradephp/common.php';
require_once PIWIK_INCLUDE_PATH .'/libs/Event/Dispatcher.php';
require_once PIWIK_INCLUDE_PATH .'/libs/Event/Notification.php';
require_once PIWIK_INCLUDE_PATH .'/core/PluginsManager.php';
require_once PIWIK_INCLUDE_PATH .'/core/Plugin.php';
require_once PIWIK_INCLUDE_PATH .'/core/Common.php';
require_once PIWIK_INCLUDE_PATH .'/core/Tracker.php';
require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Config.php';
require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Db.php';
require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Visit.php';
require_once PIWIK_INCLUDE_PATH .'/core/Tracker/GoalManager.php';
require_once PIWIK_INCLUDE_PATH .'/core/Tracker/Action.php';
require_once PIWIK_INCLUDE_PATH .'/core/CacheFile.php';
require_once PIWIK_INCLUDE_PATH .'/core/Cookie.php';
session_cache_limiter('nocache');
ob_start();
@date_default_timezone_set('UTC');
if($GLOBALS['PIWIK_TRACKER_DEBUG'] === true)
{
require_once PIWIK_INCLUDE_PATH .'/core/Loader.php';
require_once PIWIK_INCLUDE_PATH .'/core/ErrorHandler.php';
require_once PIWIK_INCLUDE_PATH .'/core/ExceptionHandler.php';
set_error_handler('Piwik_ErrorHandler');
set_exception_handler('Piwik_ExceptionHandler');
printDebug($_GET);
Piwik_Tracker_Db::enableProfiling();
Piwik::createConfigObject();
Piwik::createLogObject();
}
if(!defined('PIWIK_ENABLE_TRACKING') || PIWIK_ENABLE_TRACKING)
{
$process = new Piwik_Tracker();
$process->main();
ob_end_flush();
printDebug($_COOKIE);
}