[Piwik-trac] [Piwik] #134: API to push data into Piwik without using the javascript tag
Piwik
trac at piwik.org
Tue Jun 10 02:45:53 CEST 2008
#134: API to push data into Piwik without using the javascript tag
--------------------+-------------------------------------------------------
Reporter: matt | Owner:
Type: Bug | Status: new
Priority: major | Milestone: Stable release
Component: Core | Version:
Resolution: | Keywords:
--------------------+-------------------------------------------------------
Old description:
> Currently data can be pushed in the database using the piwik.php script,
> called from the piwik.js tag.
>
> However in some cases we want to push statistics from within PHP or other
> languages. For example, if we want to count all hits on a given file (for
> example http://piwik.org/last.zip) this file could instead be a script
> issuing a request to record a new download, and then redirect the user to
> the actual file requested.
>
> In php the file last.zip could be a PHP file with the content:
> {{{
> <?php
> // this file will record the download and then redirect the user to the
> file
>
> // we first call the PIWIK push API in order to record this download
> Piwik_LogStats_API::logNewDownload('last.zip');
>
> // we load the requested file so the user can download it
> readfile('files/last.zip'); // see php.net/readfile
>
> ?>
> }}}
New description:
Currently data can be pushed in the database using the piwik.php script,
called from the piwik.js tag.
However in some cases we want to push statistics from within PHP or other
languages. For example, if we want to count all hits on a given file (for
example http://piwik.org/last.zip) this file could instead be a script
issuing a request to record a new download, and then redirect the user to
the actual file requested.
In php the file last.zip could be a PHP file with the content:
{{{
<?php
// this file will record the download and then redirect the user to the
file
// we first call the PIWIK push API in order to record this download
Piwik_LogStats_API::logNewDownload('last.zip');
// we load the requested file so the user can download it
readfile('files/last.zip'); // see php.net/readfile
?>
}}}
Next steps:
* list use cases for such an API
* specify an API based on use cases
* implement reusing /refactoring existing code in the LogStats* classes.
--
Ticket URL: <http://dev.piwik.org/trac/ticket/134#comment:1>
Piwik <http://piwik.org>
Piwik, open source web analytics software
More information about the Piwik-trac
mailing list