[Piwik-svn] r392 - trunk/misc
svnmaster at piwik.org
svnmaster at piwik.org
Thu Mar 20 02:40:20 CET 2008
Author: matt
Date: 2008-03-20 02:40:18 +0100 (Thu, 20 Mar 2008)
New Revision: 392
Modified:
trunk/misc/api_example_marketing.php
Log:
- updating piwik example
Modified: trunk/misc/api_example_marketing.php
===================================================================
--- trunk/misc/api_example_marketing.php 2008-03-19 01:37:32 UTC (rev 391)
+++ trunk/misc/api_example_marketing.php 2008-03-20 01:40:18 UTC (rev 392)
@@ -2,8 +2,8 @@
<p>This report is automatically computed in PHP using the <a href='http://dev.piwik.org/trac/wiki/API/Reference'>Piwik APIs</a>. In <a href='http://dev.piwik.org/trac/browser/trunk/misc/api_example_marketing.php'>a few lines of simple PHP</a> (you could use any other language) you can get the data and generate this kind of report.
</p><p>This report is generated in order to see how <a href='http://piwik.org'>Piwik.org</a> visitors are interested in Piwik, which we determine by the ratio of visitors that look the <a href='http://piwik.org/demo'>online demo</a>.</p>
<?php
-$visitsDemo = file_get_contents('http://piwik.org/demo/?module=API&method=Actions.getActions&idSite=1&period=day&date=last7&format=php&filter_column=label&filter_pattern=demo');
-$visitsAll = file_get_contents('http://piwik.org/demo/?module=API&method=VisitsSummary.getUniqueVisitors&idSite=1&period=day&date=last7&format=php');
+$visitsDemo = file_get_contents('http://piwik.org/demo/?module=API&method=Actions.getActions&idSite=1&period=day&date=previous7&format=php&filter_column=label&filter_pattern=demo');
+$visitsAll = file_get_contents('http://piwik.org/demo/?module=API&method=VisitsSummary.getUniqueVisitors&idSite=1&period=day&date=previous7&format=php');
$visitsDemo = unserialize($visitsDemo);
$visitsAll = unserialize($visitsAll);
@@ -13,7 +13,7 @@
print('<table border=1 cellpadding=4><thead><td>Date</td><td>Nb visits</td><td>Nb visits on /demo</td><td>Ratio</td></thead>');
foreach($visitsDemo as $date => $values)
{
- $nbVisitsDemo = $values[0]['nb_visits'];
+ $nbVisitsDemo = $values[0]['nb_uniq_visitors'];
$nbVisits = $visitsAll[$date];
$ratio = round($nbVisitsDemo * 100 / $nbVisits, 0);
$ratioSum += $ratio; $count++;
More information about the Piwik-svn
mailing list