Skip to content

Website metrics dashboard in WordPress

A client area page for a small business website: sidebar, four metrics (visits, requests, reply rate and reply time) with their change, an SVG line chart per period and a filterable table of the latest messages, with no chart library.

Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in WordPress

pattern.html
<!-- wp:html -->
<div class="tbi" data-tbi data-tbi-period="30j">
        <div class="tbi-shell" data-tbi-shell>
          <div class="tbi-side">
            <div class="tbi-brandrow">
              <a class="tbi-brand" href="#accueil"><svg class="tbi-logo" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 20 12 4l8 16"/><path d="M7.5 13h9"/></svg><span class="tbi-brandtext"><span class="tbi-brandname">Menuiserie Berthier</span><span class="tbi-brandsub">Espace client</span></span></a>
              <button class="tbi-toggle" type="button" aria-expanded="false" aria-controls="tbi-menu" data-tbi-toggle hidden><svg class="tbi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 7h16M4 12h16M4 17h16"/></svg><span>Menu</span></button>
            </div>
            <nav class="tbi-menu" id="tbi-menu" aria-label="Espace client" data-tbi-menu>
              <ul class="tbi-navlist">
                <li>
                  <a class="tbi-link" href="#tableau-de-bord" aria-current="page"><svg class="tbi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="4" y="4" width="7" height="7" rx="1.5"/><rect x="13" y="4" width="7" height="7" rx="1.5"/><rect x="4" y="13" width="7" height="7" rx="1.5"/><rect x="13" y="13" width="7" height="7" rx="1.5"/></svg><span class="tbi-linktext">Tableau de bord</span></a>
script.js
(() => {
  if (!document.querySelector(".tbi")) return;
  document.querySelectorAll("[data-tbi]").forEach((root) => {
    const on = (el, type, fn) => el.addEventListener(type, fn);
    const DATA = {
      "7j": {
        name: "7 derniers jours",
        prev: "aux 7 jours précédents",
        unit: "jour",
        points: [
          ["jeudi 5 novembre", 48],
          ["vendredi 6 novembre", 41],
style.css
:root {
  --tbi-bg: #f4f2ee;
  --tbi-card: #ffffff;
  --tbi-text: #1c2430;
  --tbi-muted: #555f6d;
  --tbi-line: #e2ddd5;
  --tbi-soft: #f1ede6;
  --tbi-side: #1d2733;
  --tbi-side-text: #eef2f6;
  --tbi-side-muted: #aab5c3;
  --tbi-side-hover: #283544;
  --tbi-side-current: #334355;
tableau-de-bord-indicateurs-site.php
<?php
/**
 * Plugin Name: Forge, Tableau de bord d’indicateurs du site
 * Description: Une page d’espace client pour site vitrine : barre latérale, quatre indicateurs (visites, demandes, taux et délai de réponse) avec leur évolution, courbe SVG par période et tableau filtrable des derniers messages, sans bibliothèque de graphiques. Ajoute la composition « Tableau de bord d’indicateurs du site » à l'éditeur de blocs.
 * Version: 1.0.0
 * Requires at least: 6.6
 * Requires PHP: 8.1
 * Author: Forge
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: forge-tableau-de-bord-indicateurs-site
 *

Free component: copy it freely, including for commercial projects.

Statistics components in WordPress
  • Three semicircle gauges whose needle swings to the value, with figure, label and source readable as text, in pure CSS.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A row of guarantees (ten-year insurance, free quote, call-out within 24 hours, RGE and Qualibat labels) that reassures visitors right below the call to action.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four key figures in cards that count up from zero to their value when the section scrolls into view, with icon, unit and label.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four tinted paper cards pinned askew with tape on a dotted background: each figure of the venue's story has its line drawing, its title and its sentence.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four key figures in a row, each with its caption, separated by thin rules.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component