// - https://redmine.cubedesigners.com/issues/5473
const SHOW_VISITORS_CUTOFF = 20687;
- const TOKENS=[
+ const TOKENS = [
'stats3.fluidbook.com' => '9df722a0bd30878ddc4d737352427502',
'stats4.fluidbook.com' => '3ffdbe052ae625f065573df9fa9515df',
'stats5.fluidbook.com' => '85e9cc307b6e5083249949e9472a80b8',
$this->hash = $this->fluidbook->hash;
$this->setLanguage(app()->getLocale());
- $this->viewData = new Data(['fluidbook_id' => $fluidbook->id, 'hash' => $this->hash, 'title' => $fluidbook->title,'page_count'=>$fluidbook->getPagesNumber()]);
+ $this->viewData = new Data(['fluidbook_id' => $fluidbook->id, 'hash' => $this->hash, 'title' => $fluidbook->title, 'page_count' => $fluidbook->getPagesNumber(), 'base_URL' => route('stats', ['fluidbook_id' => $this->fluidbook_id, 'hash' => $this->hash])]);
parent::__construct('https://' . static::getMatomoServer($this->fluidbook->id) . '/', null, $this->fluidbook_id);
}
{
$this->setDatesAndPeriod($period_override);
+ $this->viewData->visits_summary = $this->getVisitsSummary();
+ if($this->fluidbook_id<self::SHOW_VISITORS_CUTOFF && isset($this->viewData->visits_summary['nb_uniq_visitors'])){
+ unset($this->viewData->visits_summary['nb_uniq_visitors']);
+ }
+ dd($this->viewData->visits_summary);
+
$this->_eventsByPeriod = $this->_processEventsByPeriod();
$this->_eventsByPage = $this->_processEventsByPage();
// The goal is to find the non-empty results and create a list of Carbon date classes from those
// This list is used to generate the links / formatted dates list + detailed data table
$this->viewData->period_details = $this->_pagesByPeriod->filter(fn($value, $key) => !empty($value)); // Remove any empty periods
+ //dd($this->viewData->period_details);
$this->viewData->chart_datasets = $this->_processCharts();
// Main summary table
'summary' => [
'formatted_date' => self::getPeriods()[$this->getPeriod()]['singular'],
- 'nb_uniq_visitors' => __('Visiteurs uniques'),
- 'nb_visits' => __('Visites'),
'nb_hits' => __('Pages vues'),
'nb_links' => __('Liens sortants'),
'nb_downloads' => __('Téléchargements'),
protected function statsSummary($fluidbook_id, $hash, $date = null, $period_override = null)
{
$fluidbook = FluidbookPublication::withoutGlobalScopes()->where('id', $fluidbook_id)->where('hash', $hash)->firstOrFail();
-
- $locale = app()->getLocale();
- $base_URL = route('stats', compact('fluidbook_id', 'hash')); // Used by date range picker to update report URL
-
- $data = compact(
- 'fluidbook_id',
- 'hash',
- 'date',
- 'fluidbook',
- 'locale',
- 'base_URL',
- );
-
- $stats = new Stats($fluidbook, $date);
- $data = array_merge($data, $stats->processData($period_override));
-
+ $stats = new Stats($fluidbook);
+ $data = $stats->processData($period_override);
+ $data['locale'] = app()->getLocale();
+ $data['fluidbook'] = $fluidbook;
return view('fluidbook_stats.summary', $data);
}
<dt>{{ __('Nombre de pages') }}</dt>
<dd>{{ $page_count }}</dd>
+ @if(isset($visits_summary['nb_uniq_visitors']))
+ <dt>{{ __('Visiteurs uniques') }}</dt>
+ <dd>{{ $visits_summary['nb_uniq_visitors'] }}</dd>
+ @endif
+
+ <dt>{{ __('Visites') }}</dt>
+ <dd>{{ $visits_summary['nb_visits'] }}</dd>
+
+
{{-- Summary of totals --}}
@if($period_details->isNotEmpty())
@foreach ($table_map['summary'] as $summary_key => $summary_heading)
arrow.className = 'arrow-right';
rangeInputs.insertBefore(arrow, rangeInputs.children[1]); // Insert in 2nd position
-@can('fluidbook-publication:admin')
+ @can('fluidbook-publication:admin')
<div style="text-align: right;margin-top: 20px;">
- <a target="_blank"
- href="{{route('statsmatomo',['fluidbook_id'=>$fluidbook->id,'hash'=>$fluidbook->hash])}}">{{__('Voir les données brutes sur Matomo')}}</a>
- @can('superadmin')
- | <a target="_blank" href="/fluidbook-publication/stats/API/{{$fluidbook->id}}">{{__('API Matomo')}}</a>
- @endcan
+ <a target="_blank"
+ href="{{route('statsmatomo',['fluidbook_id'=>$fluidbook->id,'hash'=>$fluidbook->hash])}}">{{__('Voir les données brutes sur Matomo')}}</a>
+ @can('superadmin')
+ | <a target="_blank" href="/fluidbook-publication/stats/API/{{$fluidbook->id}}">{{__('API Matomo')}}</a>
+ @endcan
</div>
-@endcan
+ @endcan
</script>