Ticket #134 (new Bug)

Opened 9 months ago

Last modified 21 hours ago

API to push data into Piwik without using the javascript tag

Reported by: matt Assigned to:
Priority: major Milestone: Future features
Component: Core Version:
Keywords: Cc:

Description (Last modified by matt)

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.

Change History

06/10/08 02:45:52 changed by matt

  • description changed.

11/20/08 13:19:19 changed by matt

  • milestone changed from Stable release to Future features.