{# ============================== #} {# PAGE 1 : VUE D'ENSEMBLE #} {# ============================== #}

Rapport statistiques

Periode : {{ periodLabel }} — Genere le {{ "now"|date("d/m/Y H:i") }}
{# --- Macro tendance PDF --- #} {% macro pdf_trend(trend, invert) %} {% if trend is defined and trend is not null %} {% set dir = trend.direction %} {% set delta = trend.delta %} {% set good = (dir == 'up' and not invert) or (dir == 'down' and invert) %} {% set bad = (dir == 'down' and not invert) or (dir == 'up' and invert) %}
{% if dir == 'up' %}▲{% elseif dir == 'down' %}▼{% else %}={% endif %} {% if delta is not null %}{{ delta > 0 ? '+' : '' }}{{ delta }}%{% elseif dir == 'up' %}Nouveau{% endif %}
{% endif %} {% endmacro %} {# --- KPI Visiteurs + Comportement --- #}
Indicateurs cles
{{ visitors.value }}
Visiteurs
{{ _self.pdf_trend(visitors.trend, false) }}
{{ behavior.avg_duration ? (behavior.avg_duration // 60 ~ 'm' ~ '%02d'|format(behavior.avg_duration % 60) ~ 's') : '—' }}
Duree moyenne
{{ _self.pdf_trend(behavior.avg_duration_trend ?? null, false) }}
{{ behavior.bounce_rate is not null ? behavior.bounce_rate ~ '%' : '—' }}
Taux de rebond
{{ _self.pdf_trend(behavior.bounce_rate_trend ?? null, true) }}
{{ behavior.avg_depth ?? '—' }}
Pages / session
{{ _self.pdf_trend(behavior.avg_depth_trend ?? null, false) }}
{{ behavior.avg_scroll is not null ? behavior.avg_scroll ~ '%' : '—' }}
Scroll moyen
{{ _self.pdf_trend(behavior.avg_scroll_trend ?? null, false) }}
{# --- Entonnoir de conversion --- #}
Entonnoir de conversion
{% set max = funnel.visitors > 0 ? funnel.visitors : 1 %}
Etape Nombre Taux
Visiteurs uniques {{ funnel.visitors }} 100%
> 1 page visitee {{ funnel.engaged }} {{ (funnel.engaged / max * 100)|round(1) }}%
Vu page contact {{ funnel.saw_contact }} {{ (funnel.saw_contact / max * 100)|round(1) }}%
Conversions {{ funnel.converted }} {{ funnel.rate ?? 0 }}%
{# --- KPI Conversions --- #}
Conversions par type
{{ counts.phone_click }}
Appels
{{ _self.pdf_trend(counts.phone_click_trend ?? null, false) }}
{{ counts.email_click }}
Emails
{{ _self.pdf_trend(counts.email_click_trend ?? null, false) }}
{{ counts.form_submit }}
Formulaires
{{ _self.pdf_trend(counts.form_submit_trend ?? null, false) }}
{{ counts.total }}
Total
{{ _self.pdf_trend(counts.total_trend ?? null, false) }}
{# ============================== #} {# PAGE 2 : ACQUISITION #} {# ============================== #}
{# --- Sources de trafic --- #}
Acquisition — Sources de trafic
{% if sources|length > 0 %} {% set totalSrc = sources|reduce((c, s) => c + s.cnt, 0) %} {% for s in sources %} {% endfor %}
Source Sessions Part
{% set srcType = s.source starts with 'seo' ? 'seo' : (s.source starts with 'social' ? 'social' : s.source) %} {{ s.source|replace({'_': ' '})|capitalize }} {{ s.cnt }} {{ totalSrc > 0 ? (s.cnt / totalSrc * 100)|round(1) : 0 }}%
{% else %}

Aucune donnee.

{% endif %}
{# --- Appareils --- #}
Acquisition — Appareils
{% if devices|length > 0 %} {% set devTotal = devices|reduce((c, d) => c + d.cnt, 0) %} {% set deviceLabels = { desktop: 'Desktop', mobile: 'Mobile', tablet: 'Tablette', unknown: 'Inconnu' } %} {% for d in devices %} {% endfor %}
Appareil Sessions Part
{{ deviceLabels[d.device_type] ?? d.device_type }} {{ d.cnt }} {{ devTotal > 0 ? (d.cnt / devTotal * 100)|round(1) : 0 }}%
{% else %}

Aucune donnee.

{% endif %}
{# --- Heatmap temporel --- #} {% if heatmap.max > 0 %}
Activite par jour et heure
{% for h in heatmap.hours %} {% endfor %} {% for dayIdx, dayLabel in heatmap.days %} {% for hour in heatmap.hours %} {% set val = heatmap.grid[dayIdx][hour] %} {% set intensity = heatmap.max > 0 ? (val / heatmap.max) : 0 %} {% endfor %} {% endfor %}
{{ h }}h
{{ dayLabel }} {{ val > 0 ? val : '' }}
{% endif %} {# --- Pages d'entree --- #}
Acquisition — Pages d'entree
{% if landingPages|length > 0 %} {% for lp in landingPages %} {% endfor %}
Page Sessions
{{ lp.landing_page }} {{ lp.cnt }}
{% else %}

Aucune donnee.

{% endif %}
{# ============================== #} {# PAGE 3 : COMPORTEMENT #} {# ============================== #}
{# --- Detail par page --- #}
Comportement — Detail par page
{% if topPages|length > 0 %} {% for page in topPages %} {% endfor %}
Page Vues Duree moy. Scroll Rebond
{{ page.url }} {{ page.views }} {{ page.avg_duration ? (page.avg_duration // 60 ~ ':' ~ '%02d'|format(page.avg_duration % 60)) : '—' }} {{ page.avg_scroll ? page.avg_scroll ~ '%' : '—' }} {{ page.bounce_rate is not null ? page.bounce_rate ~ '%' : '—' }} {% if page.avg_duration is not null and page.avg_duration > 120 and page.avg_scroll is not null and page.avg_scroll > 70 %} {% endif %}

★ = Bon engagement (duree > 2min et scroll > 70%)

{% else %}

Aucune donnee.

{% endif %}
{# --- Pages de sortie --- #}
Comportement — Pages de sortie
{% if exitPages|length > 0 %} {% for ep in exitPages %} {% endfor %}
Page Sorties Taux sortie
{{ ep.exit_page }} {{ ep.exit_sessions }} {{ ep.exit_rate }}%
{% else %}

Aucune donnee.

{% endif %}
{# ============================== #} {# PAGE 4 : CONVERSIONS DETAIL #} {# ============================== #}
{# --- Pages qui convertissent --- #} {% if conversionPages|length > 0 %}
Conversions — Pages moteur
{% for cp in conversionPages %} {% endfor %}
Page Conversions
{{ cp.page_url }} {{ cp.cnt }}
{% endif %} {# --- Parcours type --- #} {% if conversionPaths|length > 0 %}
Conversions — Parcours type
{% for cp in conversionPaths %} {% endfor %}
Parcours Sessions Part
{{ cp.path }} {{ cp.count }} {{ cp.pct }}%
{% endif %} {# --- Pages critiques --- #} {% if criticalPages|length > 0 %}
Conversions — Pages critiques
{% for cp in criticalPages %} {% endfor %}
Page Sessions Presence
{{ cp.url }} {{ cp.sessions }} {{ cp.pct }}% {% if cp.pct > 50 %}{% endif %}

★ = Page strategique (presente dans > 50% des conversions)

{% endif %} {# --- Detail des conversions --- #}
Conversions — Detail
{% if conversions|length > 0 %} {% for row in conversions %} {% endfor %}
Date Type Page Source Detail
{{ row.date }} {% if row.type == 'phone_click' %}Appel {% elseif row.type == 'email_click' %}Email {% else %}Formulaire {% endif %} {{ row.page_url }} {{ (row.source ?? 'direct')|replace({'_': ' '})|capitalize }} {{ row.detail ?? '—' }}
{% else %}

Aucune conversion sur cette periode.

{% endif %}