PDF rausgenommen
This commit is contained in:
17
msd2/tracking/piwik/misc/others/ExamplePiwikTracker.php
Normal file
17
msd2/tracking/piwik/misc/others/ExamplePiwikTracker.php
Normal file
@ -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';
|
30
msd2/tracking/piwik/misc/others/api_rest_call.php
Normal file
30
msd2/tracking/piwik/misc/others/api_rest_call.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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=7
|
||||
$url = "https://demo.matomo.org/";
|
||||
$url .= "?module=API&method=Referrers.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>\n");
|
||||
foreach ($content as $row) {
|
||||
$keyword = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
|
||||
$hits = $row['nb_visits'];
|
||||
|
||||
print("<b>$keyword</b> ($hits hits)<br>\n");
|
||||
}
|
||||
|
11
msd2/tracking/piwik/misc/others/download-count.txt
Normal file
11
msd2/tracking/piwik/misc/others/download-count.txt
Normal file
@ -0,0 +1,11 @@
|
||||
Count the download for 'latest.zip' on the 20th March
|
||||
|
||||
# cat access.log | grep "20/Mar" | grep "latest.zip" | awk '{print $1}' | sort | uniq | wc -l
|
||||
|
||||
Value to be compared with the one given by Piwik in Actions > Downloads
|
||||
|
||||
Count the no of hits by referrers, excluding piwik.org as a referer
|
||||
# cat /var/log/apache2/access.log | awk '{print $11}' | grep -vE "(^"-"$|/dev.piwik.org|/piwik.org)" | sort | uniq -c | sort -rn | head -n20
|
||||
|
||||
Count the no of hits by referrers
|
||||
# cat /var/log/apache2/access.log | awk '{print $11}' | sort | uniq -c | sort -rn | head -n20
|
5
msd2/tracking/piwik/misc/others/geoipUpdateRows.php
Normal file
5
msd2/tracking/piwik/misc/others/geoipUpdateRows.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
echo "This script has been removed, instead use the 'usercountry:attribute' command.\n";
|
||||
echo "For example, run 'php /path/to/piwik/console usercountry:attribute 2012-01-01,2013-01-01'.\n";
|
||||
echo "To learn more about the new command, run 'php /path/to/piwik/console help usercountry:attribute'.\n";
|
76
msd2/tracking/piwik/misc/others/iframeWidget_localhost.php
Normal file
76
msd2/tracking/piwik/misc/others/iframeWidget_localhost.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
use Piwik\FrontController;
|
||||
use Piwik\Url;
|
||||
use Piwik\UrlHelper;
|
||||
use Piwik\Widget\WidgetsList;
|
||||
|
||||
exit;
|
||||
$date = date('Y-m-d');
|
||||
$period = 'month';
|
||||
$idSite = 1;
|
||||
$url = "http://localhost/trunk/index.php?token_auth=0b809661490d605bfd77f57ed11f0b14&module=Widgetize&action=iframe&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&idSite=$idSite&period=$period&date=$date&disableLink=1";
|
||||
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<h3 style="color:#143974">Embedding the Piwik Country widget in an Iframe</h3>
|
||||
|
||||
<p>Loads a widget from localhost/trunk/ with login=root, pwd=test. <a href='<?= $url ?>'>Widget URL</a></p>
|
||||
|
||||
<div id="widgetIframe">
|
||||
<iframe width="500" height="350"
|
||||
src="<?php echo $url; ?>" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<?php
|
||||
$_GET['idSite'] = $idSite;
|
||||
define('PIWIK_INCLUDE_PATH', '../..');
|
||||
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";
|
||||
|
||||
FrontController::getInstance()->init();
|
||||
$widgets = WidgetsList::get()->getWidgetConfigs();
|
||||
$widgetCategoriesHandled = array();
|
||||
foreach ($widgets as $widgetConfig) {
|
||||
$category = $widgetConfig->getCategoryId();
|
||||
|
||||
if (!empty($widgetCategoriesHandled[$category])) {
|
||||
continue;
|
||||
}
|
||||
$widgetCategoriesHandled[$category] = true;
|
||||
|
||||
echo '<h2>' . $category . '</h2>';
|
||||
|
||||
foreach ($widgets as $widget) {
|
||||
if ($category !== $widget->getCategoryId()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<h3>' . \Piwik\Piwik::translate($widget->getName()) . '</h3>';
|
||||
$widgetUrl = UrlHelper::getArrayFromQueryString($url);
|
||||
$widgetUrl['moduleToWidgetize'] = $widget->getModule();
|
||||
$widgetUrl['actionToWidgetize'] = $widget->getAction();
|
||||
$parameters = $widget->getParameters();
|
||||
unset($parameters['module']);
|
||||
unset($parameters['action']);
|
||||
foreach ($parameters as $name => $value) {
|
||||
if (is_array($value)) {
|
||||
$value = current($value);
|
||||
}
|
||||
$widgetUrl[$name] = $value;
|
||||
}
|
||||
$widgetUrl = Url::getQueryStringFromParameters($widgetUrl);
|
||||
|
||||
echo '<div id="widgetIframe"><iframe width="500" height="350"
|
||||
src="' . $widgetUrl . '" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe></div>';
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
5
msd2/tracking/piwik/misc/others/stress.sh
Normal file
5
msd2/tracking/piwik/misc/others/stress.sh
Normal file
@ -0,0 +1,5 @@
|
||||
echo "
|
||||
Stress testing piwik.php
|
||||
========================
|
||||
"
|
||||
ab -n5000 -c50 "http://localhost/dev/piwiktrunk/piwik.php?url=http%3A%2F%2Flocalhost%2Fdev%2Fpiwiktrunk%2F&action_name=&idsite=1&res=1280x1024&col=24&h=18&m=46&s=59&fla=1&dir=0&qt=1&realp=1&pdf=0&wma=1&java=1&cookie=1&title=&urlref="
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// -- Piwik Tracking API init --
|
||||
require_once "../../libs/PiwikTracker/PiwikTracker.php";
|
||||
PiwikTracker::$URL = 'http://localhost/matomo-master/';
|
||||
// Example 1: Tracks a pageview for Website id = {$IDSITE}
|
||||
$trackingURL = Piwik_getUrlTrackPageView($idSite = 16, $customTitle = 'This title will appear in the report Actions > Page titles');
|
||||
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<!-- Matomo -->
|
||||
<script type="text/javascript">
|
||||
var _paq = _paq || [];
|
||||
(function() {
|
||||
var u="//localhost/matomo-master/";
|
||||
_paq.push(["setTrackerUrl", u+"matomo.php"]);
|
||||
_paq.push(["setSiteId", "16"]);
|
||||
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0];
|
||||
g.type="text/javascript"; g.async=true; g.defer=true; g.src=u+"matomo.js"; s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
</script>
|
||||
<!-- End Matomo Code -->
|
||||
|
||||
This page loads a Simple Tracker request to Matomo website id=1
|
||||
|
||||
<?php
|
||||
echo '<img src="' . htmlentities($trackingURL, ENT_COMPAT | ENT_HTML401, 'UTF-8') . '" alt="" />';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
exit; // Remove this line before using the script
|
||||
|
||||
// How to remove the piwik/ directory if it does not work in FTP?
|
||||
// 1) Download and upload this file to your webserver
|
||||
// 2) Remove the 2nd line (the "exit;")
|
||||
// 3) Put this file in the folder that contains the piwik/ directory (above the piwik/ directory)
|
||||
// For example if the piwik/ folder is at http://your-site/piwik/ you put the file in http://your-site/uninstall-delete-piwik-directory.php
|
||||
// 4) Go with your browser to http://your-site/uninstall-delete-piwik-directory.php
|
||||
// 5) The folder http://your-site/piwik/ should now be deleted!
|
||||
// We hope you enjoyed Piwik. If you have any feedback why you stopped using Piwik,
|
||||
// please let us know at hello@matomo.org - we are interested by your experience
|
||||
function unlinkRecursive($dir)
|
||||
{
|
||||
if (!$dh = @opendir($dir)) return "Warning: folder $dir couldn't be read by PHP";
|
||||
while (false !== ($obj = readdir($dh))) {
|
||||
if ($obj == '.' || $obj == '..') {
|
||||
continue;
|
||||
}
|
||||
if (!@unlink($dir . '/' . $obj)) {
|
||||
unlinkRecursive($dir . '/' . $obj, true);
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
@rmdir($dir);
|
||||
return "Folder $dir deleted!";
|
||||
}
|
||||
|
||||
echo unlinkRecursive('piwik/');
|
@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<body>
|
||||
<p>Number of visits per week for the last 52 weeks</p>
|
||||
|
||||
<div id="widgetIframe">
|
||||
<iframe width="800" height="450"
|
||||
src="https://matomo.org/demo/index.php?module=Widgetize&action=iframe&moduleToWidgetize=VisitsSummary&actionToWidgetize=getEvolutionGraph&idSite=1&period=week&date=last52&columns[]=nb_visits&disableLink=1"
|
||||
scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user