diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-09 04:43:58 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-09 04:43:58 +0400 |
commit | bf844f253688502cf2280bdeffcb2d46f8a276de (patch) | |
tree | 34897bb4bb82207aea6886ebab7c9ca3c86a1353 /misc/others | |
parent | 4d176fc6a9c52658151dc09eb063d995744be049 (diff) |
Finish the job (Also updated website docs referring to these files)
git-svn-id: http://dev.piwik.org/svn/trunk@7131 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'misc/others')
-rw-r--r-- | misc/others/ExamplePiwikTracker.php | 17 | ||||
-rw-r--r-- | misc/others/api_internal_call.php | 28 | ||||
-rw-r--r-- | misc/others/api_rest_call.php | 32 | ||||
-rw-r--r-- | misc/others/db-schema.png | bin | 0 -> 90134 bytes |
4 files changed, 77 insertions, 0 deletions
diff --git a/misc/others/ExamplePiwikTracker.php b/misc/others/ExamplePiwikTracker.php new file mode 100644 index 0000000000..6ae01bbddc --- /dev/null +++ b/misc/others/ExamplePiwikTracker.php @@ -0,0 +1,17 @@ +<?php +// Example file to demonstrate PiwikTracker.php +// See http://piwik.org/docs/tracking-api/ +require_once '../libs/PiwikTracker/PiwikTracker.php'; +PiwikTracker::$URL = 'http://localhost/trunk/'; + +$piwikTracker = new PiwikTracker( $idSite = 1 ); +// You can manually set the Visitor details (resolution, time, plugins) +// See all other ->set* functions available in the PiwikTracker class +$piwikTracker->setResolution(1600, 1400); + +// Sends Tracker request via http +$piwikTracker->doTrackPageView('Document title of current page view'); +// You can also track Goal conversions +$piwikTracker->doTrackGoal($idGoal = 1, $revenue = 42); + +echo 'done';
\ No newline at end of file diff --git a/misc/others/api_internal_call.php b/misc/others/api_internal_call.php new file mode 100644 index 0000000000..2fdb14bb01 --- /dev/null +++ b/misc/others/api_internal_call.php @@ -0,0 +1,28 @@ +<?php +// if you don't include 'index.php', you must also define PIWIK_DOCUMENT_ROOT +// and include "libs/upgradephp/upgrade.php" and "core/Loader.php" +define('PIWIK_INCLUDE_PATH', realpath('..')); +define('PIWIK_USER_PATH', realpath('..')); +define('PIWIK_ENABLE_DISPATCH', false); +define('PIWIK_ENABLE_ERROR_HANDLER', false); +define('PIWIK_ENABLE_SESSION_START', false); + +require_once PIWIK_INCLUDE_PATH . "/index.php"; +require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php"; + +Piwik_FrontController::getInstance()->init(); + +// This inits the API Request with the specified parameters +$request = new Piwik_API_Request(' + method=UserSettings.getResolution + &idSite=7 + &date=yesterday + &period=week + &format=XML + &filter_limit=3 + &token_auth=anonymous +'); +// Calls the API and fetch XML data back +$result = $request->process(); +echo $result; + diff --git a/misc/others/api_rest_call.php b/misc/others/api_rest_call.php new file mode 100644 index 0000000000..f7a7bfe995 --- /dev/null +++ b/misc/others/api_rest_call.php @@ -0,0 +1,32 @@ +<?php +exit; // REMOVE this line to run the script + +// this token is used to authenticate your API request. +// You can get the token on the API page inside your Piwik interface +$token_auth = 'anonymous'; + +// we call the REST API and request the 100 first keywords for the last month for the idsite=1 +$url = "http://demo.piwik.org/"; +$url .= "?module=API&method=Referers.getKeywords"; +$url .= "&idSite=7&period=month&date=yesterday"; +$url .= "&format=PHP&filter_limit=20"; +$url .= "&token_auth=$token_auth"; + +$fetched = file_get_contents($url); +$content = unserialize($fetched); + +// case error +if(!$content) +{ + print("Error, content fetched = ".$fetched); +} + +print("<h1>Keywords for the last month</h1>"); +foreach($content as $row) +{ + $keyword = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES); + $hits = $row['nb_visits']; + + print("<b>$keyword</b> ($hits hits)<br>"); +} + diff --git a/misc/others/db-schema.png b/misc/others/db-schema.png Binary files differnew file mode 100644 index 0000000000..709a5b1680 --- /dev/null +++ b/misc/others/db-schema.png |