mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-11 02:36:42 +02:00
feat: update analytics so to meet IABv2 requirements
- https://iabtechlab.com/wp-content/uploads/2017/12/Podcast_Measurement_v2-Dec-20-2017.pdf - no IP address is ever stored on the server. Only aggregate data is stored in the dababase. - rolling 24-hour window - castopod does not do pre-load - IP Blacklisting https://github.com/client9/ipcat - user-agent Filtering https://github.com/opawg/user-agents - ignores 2 bytes range "Range: 0-1" (performed by official Apple iOS Podcast app) - in case of partial content, adds up all requests to check >1mn was downloaded - identifying Uniques is done with a combination of IP Address and User Agent - add AMcharts - add some graphs - add regions to analytics - add ipcat blacklist - enhance useragents performances - add filesize and header size in order to calculate 1mn downloads - update publisher ID3 field - update castopod icon - add disclaimer and warning import form translation - update docs/setup-development.md closes #10
This commit is contained in:
parent
5417be0049
commit
03e23a28bf
61 changed files with 3162 additions and 540 deletions
69
app/Controllers/Admin/AnalyticsData.php
Normal file
69
app/Controllers/Admin/AnalyticsData.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @copyright 2020 Podlibre
|
||||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
||||
* @link https://castopod.org/
|
||||
*/
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Models\PodcastModel;
|
||||
use App\Models\EpisodeModel;
|
||||
|
||||
class AnalyticsData extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var \App\Entities\Podcast|null
|
||||
*/
|
||||
protected $podcast;
|
||||
protected $className;
|
||||
protected $methodName;
|
||||
protected $episode;
|
||||
|
||||
public function _remap($method, ...$params)
|
||||
{
|
||||
if (count($params) > 2) {
|
||||
if (!($this->podcast = (new PodcastModel())->find($params[0]))) {
|
||||
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound(
|
||||
'Podcast not found: ' . $params[0]
|
||||
);
|
||||
}
|
||||
$this->className = '\App\Models\Analytics' . $params[1] . 'Model';
|
||||
$this->methodName = 'getData' . $params[2];
|
||||
if (count($params) > 3) {
|
||||
if (
|
||||
!($this->episode = (new EpisodeModel())
|
||||
->where([
|
||||
'podcast_id' => $this->podcast->id,
|
||||
'id' => $params[3],
|
||||
])
|
||||
->first())
|
||||
) {
|
||||
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound(
|
||||
'Episode not found: ' . $params[3]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$method();
|
||||
}
|
||||
public function getData()
|
||||
{
|
||||
$analytics_model = new $this->className();
|
||||
$methodName = $this->methodName;
|
||||
if ($this->episode) {
|
||||
return $this->response->setJSON(
|
||||
$analytics_model->$methodName(
|
||||
$this->podcast->id,
|
||||
$this->episode->id
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return $this->response->setJSON(
|
||||
$analytics_model->$methodName($this->podcast->id)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue